Here we will learn what is Uniform Resource Identifier (URI), a character string that helps in identifying a resource on the Internet:
In our daily life, we refer to many objects and every object is identified by its name. But a name is not a unique identifier. There can be many people with the same name.
The next element which assists in making the name unique is the location or the address. The address has a hierarchical structure that helps us to navigate to the specific location and reach the specific person with the name. For example, Flat No, Building Name, Suburb, City, Country.
What You Will Learn:
What Is URI (Uniform Resource Identifier)
Similar to the real world, the web world is also loaded with lots of information and documents which are distributed worldwide. In order to reach the specific document on the web, we need a unique identifier.
A sequence of characters that identifies a logical or physical resource uniquely in Web technology is called a Uniform Resource Identifier.
Types Of URIs
The main two types of URI are
- Uniform Resource Locator (URL)
- Uniform Resource Name (URN)
The other types are
- Uniform Resource Characteristics (URC)
- Data URI
Uniform Resource Locator (URL)
- It gives the location of the object in a disciplined and structured format. This enables a unique identification of the object. But any change in the location of the object, due to say a server change, cannot be carried out automatically.
- URLs are a subset of URIs. All URLs are URIs, but all URIs are not URLs.
- For Example, mailto:firstname.lastname@example.org & ftp://webpage.com/download.jpg
Uniform Resource Name (URN)
- It gives the name of the object which may not be unique. There is no common universal standard for naming the object. Hence this method to identify objects uniquely has failed.
- Example: urn:isbn:00934563 identifies a book by its unique ISBN number
Uniform Resource Characteristics/Citations (URC)
- It gives basic metadata about the resource that can be understood by humans and also parsed by a machine.
- URCs were a third identifier type. The purpose was to give a standardized representation of document properties, such as access restrictions, encoding, owner, etc.
- Example: view-source: http://exampleURC.com/ is a URC pointing to the HTML source code of a page.
- The basic functional expectation from a URC is structure, encapsulation, scalability, caching, resolution, easy readability, and interchangeability between protocols like TCP, SMTP, FTP, etc.
- URCs were never practiced and are not so popular, but the core concepts influenced future technologies like RDF.
- Data can be directly placed into a Uniform Resource Identifier instead of giving its location (URL) and Name (URN). Data URI allows embedding all kinds of objects within a web page. It is very useful to load frequently used images or lots of small images (less than 32×32 pixels).
- Performance enhancement is the main purpose of using data Identifiers. All resources used in the website are fetched by the browser using an HTTP request and almost all browsers limit the concurrent HTTP request usage to two. This creates a bottleneck of data impacting the overall performance of the site.
- Data URI removes the need for the browser to fetch additional resources and helps in performance improvement.
- It is important to note that the base64 encoding enlarges the images to ~ 30%. So, data URI with base64 encoding should be avoided if image size is of importance.
- Second, the decoding process involved makes the initial page load slower.
- Syntax: data: [media type] [; base64], [data]
- Media type -> It is optional. But it is always a good idea to include it. The default is “text/plain”.
- base64 -> It is optional. It indicates that the data is base64 encoded data.
- Data -> The data that needs to be embedded in the page.
- Example: data:,Hello%2021World.
Also, Read =>> Difference Between URL And URI
Features Of URI
Listed below are the main features or basic requirements for Uniform Resource Identifier:
- Uniqueness: Uniform Resource Identifier should give every resource available on the Internet or worldwide web a unique distinguishing identity.
- Universality: It should be able to identify or address every available resource on the Internet.
- Extensibility: New resources which are not yet a part of the worldwide web should be able to be identified by a unique new Uniform Resource Identifier.
- Fixability: This Identifier should be editable and changeable. It should be shareable and printable.
Syntax Of Uniform Resource Identifier
Internet Engineering Task Force IETF and Worldwide Web Consortium (W3C), an international community working to develop web standards, has published a document RFC 1630. This document provides guidance and information to the Internet community for a unifying syntax to encode the names and addresses of objects on the Internet as used by WWW.
Syntax of URI -> Prefix + Suffix
- Prefix details the protocol
- Suffix details of the location and/or resource identification
- https: Protocol
- www.google.com: location
- login.html: resource identifier (a file)
Frequently Asked Questions
Q #1) Give an example of a Uniform Resource Identifier?
Answer: https://accounts.google.com/SignUp is an example of a Uniform Resource Identifier which has both the URL, the location, and the resource identifier URN as well.
Q #2) What is HTTP Uniform Resource Identifier?
Answer: URIs generally has two parts one is the location of the object in the web world and the other is the identifier of the object. The location part starts with the scheme/protocol to access the location mentioned in the Uniform Resource Identifier.
HTTP URI signifies that the protocol to access the object is HTTP. The HTTP Uniform Resource Identifier gives detail of the host where the object can be fetched from, the port, the path, etc.
Q #3) What is URI in API testing?
Answer: The main objective of API testing is to test the ability of two applications to talk to each other efficiently and smoothly. So, we need to access the application first. The URL part of the API request enables it to hit the other application that is being tested. The HTTP request has the standard syntax of protocol, host, and path/object name.
The API response pushes the response and is presented in a readable form as a web page/image/xml etc. to the tester.
Q #4) Give an example of URI and URL?
- Examples of URL: mailto:email@example.com & ftp://webpage.com/download.jpg.
- Example of URI: urn:isbn:00939963 , , data:,Mypage%2021World
Q #5) Why is Data Uniform Resource Identifier used?
Answer: Data Uniform Resource Identifier is used to improve the Web performance and circumvent the concurrent HTTP requests limitation.
Uniform Resource Identifier is a character string that helps in identifying a resource on the World Wide Web/Internet. It helps in identifying a resource either by its address/location, or a name. Sometimes it gives both the location of the resource and the name of the resource. URL and URN are subsets of URI.
URL is a Uniform Resource Identifier that gives where the specific resource is located and also the scheme of the protocol for retrieving it. A URL protocol can be http://, ftp://, smb:// etc. URN is a Uniform Resource Identifier that uses the URN scheme and identifies the object by name. A Uniform Resource Identifier can be both a name and a locator at the same time i.e., Uniform Resource Identifier can be both a URL and URN. URCs and Data URI are also other types of this.
Recommended Reading =>> URL Vs URN
URIs are at the heart of the Web. The basic clue to the university of Web is URI – Tim Berners-Lee.