Demystifying Uniform Resource Identifiers (URIs)

Hi there! If you‘re wondering what exactly a uniform resource identifier (URI) is and why we use them all over the web, you‘ve come to the right place. In this comprehensive yet friendly guide, I‘ll explain exactly what URIs are, their key characteristics, and why they serve as the fundamental building blocks underpinning many web technologies.

So what exactly is a URI?

Let‘s start from the beginning – a URI is simply a string of characters that identifies a resource on a network. The most common type of URI is a URL, which specifies the location of a resource. However, URIs can also identify resources by name, provide metadata, or even embed data right inside them.

Here‘s a simple definition:

A Uniform Resource Identifier (URI) unambiguously identifies a resource on the internet through location, name, data, or descriptions.

URIs give the web a unified global identification system. Thanks to URIs, we can link documents together via hyperlinks, access APIs, load images, find documents uniquely – and much more!

The growth of URIs is fueling innovation

URIs have experienced massive growth alongside the expansion of the web itself:

  • Over 462 million domain names registered globally
  • Over 4 billion URLs crawled by Google alone!

As more devices, people, and organizations come online, we can expect exponential URI growth to continue – likely reaching into the trillions in the next few years!

This growth is fueling enormous innovation. New schemes like websocket URIs (ws://) and W3C Decentralized Identifiers (did:web:) expand what we can build by extending identification to more environments and use cases.

Types of URIs

There are a few common types of URIs:

Uniform Resource Locators (URLs)

URLs identify resources by location. For example, this URL points to the HTTP location of a specific web page:

https://example.com/about.html

URLs make up the vast majority of URIs used on the web.

Uniform Resource Names (URNs)

Unlike URLs, URNs identify resources by name – not location. For example, an International Standard Book Number (ISBN) URN identifies a book:

urn:isbn:9780140447965

The URN resolves to the book uniquely, regardless of where it is stored online.

URN adoption has been limited, but use cases like decentralized identity are bringing them back into prominence.

Uniform Resource Characteristics (URCs)

URCs provide metadata about a resource, such as author, license, etc. For example:

urc:https://example.com;author=Jane;license=CC-BY-ND

While not yet widely adopted, URCs inspired later metadata formats like RDF.

Data URIs

Data URIs allow you to embed images, CSV files, and other data directly into an HTML document to avoid extra HTTP requests:

<a download="data.csv" href="data:text/csv;base64,SGVsbG8sV29ybGQ=">Download CSV data</a>

This can improve page load speed, especially on mobile networks.

Anatomy of a URI

URIs have a common anatomy that looks like:

scheme:[//[user:password@]host[:port]][/path][?query][#fragment]

Here is a breakdown of each component using the URL https://john:[email protected]/wiki?country=US#NY:

     scheme: https
      auth: john:pw123
         host: wikipedia.org
        path: /wiki
     query: country=US
   fragment: NY

This structure may look complex, but enables globally unique identification of documents, apps, images, data – you name it!

For example, the host + path identifies the specific resource, the scheme selects the protocol, and query parameters add context.

Best practices for URI hygiene

Properly structuring and maintaining your URIs improves reliability and avoids nasty issues down the road:

Permanence – Avoid changing resource locations unnecessarily, as external systems may link to your URIs.

Legibility – URIs should be human-readable where possible to help debugging.

Consistency – New URIs should follow predictable patterns and conventions for stability.

Adhering to identifier best practices will ensure your URIs can securely and reliably identify resources well into the future.

URIs form the foundation of web architecture

URIs seem simple, but provide the crucial globally unique identification system that stitches the web together.

Linking – Anchor tags allow hyperlinking between sites using URIs:

<a href="https://example.com">External reference</a> 

Assets – Sites use URIs to request images, scripts, fonts, and videos:

<img src="https://cdn.site/images/dog.png">  

APIs – APIs expose endpoints via HTTP URIs that apps can access:

GET https://api.service.com/v1/report

Web standards – Schemes define communication protocols (https), relations describe resource formats (application/json).

By providing a unified global identification framework, URIs are one of the most important and fundamental web standards. Their versatility to identify any resource on any system connected to the web has driven massive innovation powering the internet as we know it!

I hope this guide has helped explain what exactly URIs are and why they play such a foundational role across web architecture. Please reach out with any other questions!

Read More Topics