Definition – Uniform Resource Identifier (URI)
A URI (Uniform Resource Identifier) is a string of characters used to identify and locate resources on the internet or within a network. It serves as a compact, standardized way to reference a specific resource and can be used to identify various types of resources, including web pages, files, documents, and more. Here’s a detailed explanation of a URI along with an example:
1. Components of a Uniform Resource Identifier (URI)
A URI typically consists of the following components:
- Scheme: The scheme indicates the protocol used to access the resource. Common schemes include http, https, ftp, mailto, file, etc.
- Authority: The authority component specifies the server or authority responsible for the resource. It may include the hostname, port, and user information.
- Path: The path component indicates the specific location of the resource on the server’s filesystem or within the web application. It starts with a forward slash (/) and may contain directories, filenames, or parameters.
- Query: (Optional) The query component provides additional parameters or data to be sent to the server. It starts with a question mark (?) and consists of key-value pairs separated by ampersands (&).
- Fragment: (Optional) The fragment component specifies a specific section or anchor within the resource. It is preceded by a hash symbol (#) and is commonly used in web pages to navigate to specific sections.
2. Example of a Uniform Resource Identifier (URI)
Let’s consider an example URI:
https://www.example.com:443/path/to/resource?param1=value1¶m2=value2#section1
In this URI:
- Scheme: Https
- Authority: http://www.example.com:443
- Path: /path/to/resource
- Query: ?param1=value1¶m2=value2
- Fragment: #section1
3. Usage of Uniform Resource Identifier (URI)
- Web Browsing: URIs are used in web browsers to access web pages by specifying the address of the desired resource.
- Hyperlinking: URIs are embedded in hyperlinks within web pages, allowing users to navigate between different web resources.
- API Endpoints: URIs are used in web APIs to specify endpoints for accessing resources or performing operations.
- File Systems: URIs can be used to identify files and directories within a file system, allowing applications to access and manipulate files.
4. URI vs. URL
While often used interchangeably, URIs and URLs are slightly different concepts:
- URI (Uniform Resource Identifier): A URI is a broader term that encompasses all types of resource identifiers, including URLs.
- URL (Uniform Resource Locator): A URL is a specific type of URI that provides the means to locate a resource by specifying its location and how to access it (scheme, authority, path, etc.).
Summary
A Uniform Resource Identifier (URI) is a string of characters used to identify a resource on the internet. URIs are essential for locating resources, such as web pages, images, and files, enabling their retrieval and interaction. A URI can be classified as a URL (Uniform Resource Locator), which specifies the location of a resource, or a URN (Uniform Resource Name), which specifies the resource’s name in a namespace.
A URI consists of several components: the scheme, authority, path, query, and fragment. The scheme indicates the protocol used to access the resource, such as http, https, ftp, or mailto. The authority includes the domain name (e.g.,www.sanchitgurukul.com) and, optionally, a port number. The path specifies the resource’s location on the server, such as /path/to/resource. The query string provides additional parameters, often for dynamic web pages, in the form of key-value pairs (e.g., ?key=value). The fragment, indicated by a #, identifies a specific part of the resource, such as a section within a webpage.
URIs are crucial for web architecture, enabling the linking, sharing, and access of resources across the internet. By providing a standardized way to reference resources, URIs facilitate interoperability and communication between different systems and applications.
Useful Links
https://datatracker.ietf.org/doc/html/rfc1738
https://sanchitgurukul.com/basic-networking
https://sanchitgurukul.com/network-security
