Understanding URIs: A Beginner's Guide
A simple guide to understanding what URIs are and it's components
Trying to understand URIs can be a bit perplexing, I know. That is why in this concise post, I will be clarifying that for you. Here's what URIs are and an easy way to understand them.
URIs for Identification
According to RFC23964, a Uniform Resource Identifier (URI) is a short string of characters used to identify either physical or abstract addresses.
Now here is the surprising part, a URI can be divided into URL and URN. Let me break it down for you:
A URN acts like a person's name, while a URL resembles the person's street address. Take a look at the example below:
URN -> urn:user:mike
URL -> http://example.org/users/mike
In simple terms, the URN defines an item’s identity (“the user’s name is mike”) and the URL provides a method for finding it (“mike can be found at example.org/users/”).
Components of URI
That diagram sure looks confusing at first glance, let's get to know what each label is:
Scheme: Identify the protocol that is currently being observed. A few examples of scheme names are FTP, HTTP, HTTPS, IRC - Internet Relay Chat, etc.
Authority: is the naming authority, who has been given authority over the namespace that is defined by the remaining portion of the URI. This is basically saying the domain you are trying to access.
Path: involves a sequence of segments separated by a forward slash ("/").
Query: consists of additional non-hierarchical identification data, frequently separated by a question mark ("?").
Fragment: gives instructions to a secondary resource that is a part of the primary resource and is denoted by the Authority, Path, and a hash ("#") to distinguish it from the others. In a much easier format, this is like describing how you want the data.
That's the basic thing you need to know when it comes to understanding and decoding URIs. The benefit of understanding this is that you get to properly understand your endpoints or make better requests to any other endpoint you want to consume.
If you found this post helpful, please tell your friends about it. Feel free to hit my profile and let's connect on other social platforms.