What is a URI (Uniform resource identifier)?

About

A Uniform Resource Identifier (URI) is a string of characters that Identify a resource.

Because a resource can be created dynamically, an URI is also a request.

Example

URL and template

http://example.com/product/id?sort=asc
http://{host}/product/{id}{?sort}

ISBN

The ISBN system for uniquely identifying books provides a typical example of the use of URNs. ISBN 0486275574 (urn:isbn:0-486-27557-4) cites, unambiguously, a specific edition of Shakespeare's play Romeo and Juliet.

To get this book, a location is needed: a URL address. A typical URL for this book on a Unix-like operating system would be a file path such as file:///home/username/RomeoAndJuliet.pdf, identifying the electronic book saved in a file on a local hard disk.

Address Mail

To open the email client application and send an email, the mailto scheme

<a href="mailto:[email protected]">link</a>

FTP

FTP

ftp://ftp.is.co.za/rfc/rfc1808.txt

Ldap

LDAP

ldap://[2001:db8::7]/c=GB?objectClass?one

Telephone

tel:+1-816-555-1212

URN example

Uniform Resource Name (URN)

urn:oasis:names:specification:docbook:dtd:xml:4.1.2

Telnet

Telnet

telnet://192.0.2.16:80/

News Room

news:comp.infosystems.www.servers.unix

Type (URI, URL and URN)

URIs can be of the type:

  • names
  • locators
  • or both.
Type Description Goal Example
Names Uniform resource name (URN) To defines an item's identity A person's name
Locators Uniform resource locator (URL) To provide a method for finding an item person's street address

Classification

Opaque

An opaque URI is an absolute URI whose scheme-specific part does not begin with a slash character ('/').

Opaque URIs are not subject to further parsing. Some examples of opaque URIs are:

Hierarchical

A hierarchical URI is subject to further parsing according to the syntax

URI = scheme ":" (/|//) [authority] path [ "?" query ] [ "#" fragment ]

where:

  • the characters ,, /,?, and # stand for themselves.
  • the scheme is required
  • the path is required but may be empty
  • /|// means that when authority is:
    • present, the path must either be empty or begin with a slash (/) character.
    • not present, the path cannot begin with two slash characters (//).

Type

Absolute

A URI is absolute if, and only if, it has a scheme component.

Absolute URI = URI without fragment identifier

An absolute hierarchical URI reference follows the pattern: ://?#

absolute-URI  = scheme ":" hier-part [ "?" query ]

More see Absolute URI

Relative

A URI that is not absolute is said to be relative

Relative URI references (which are always hierarchical) follow one of two patterns: ?# or //?#

Opaque

An opaque URI follows this pattern: :#

Token

Components of a parsed URL, which is the result of processing a URL through the URL parser

Scheme

See Web Resource - Scheme

Authority

See URI - Authority (User /Host / Port )

Path

See URI - Path

Query

A query string is the part of a URI that defines key/value data.

See URL - Query String

Fragment

URI - Fragment (Ref, Reference)

Interpretation and Access

Interpretation is independent of access. “http://localhost/” has the same interpretation for every user of that reference, even though the network interface corresponding to “localhost” may be different for each end-user:

However, an action made on the basis of that reference will take place in relation to the end-user's context.

Global vs user context

An action intended to refer to a globally unique thing must use a URI that distinguishes that resource from all other things. URIs that identify in relation to the end-user's local context should only be used when the context itself is a defining aspect of the resource, such as when an on-line help manual refers to a file on the end-user's file system (e.g., "file:///etc/hosts").

Management

Encoding

Because an URL uses characters to delimit its component such as the /, ?, #, if you want to use this character in a URL as value, you need to encode them.

See What is URL encoding ? known also as Percent-encoding

Compare

Normalization and Comparison

Example: Simple String Comparison

Template

You can create templates of URI and expand them to create URI with variables.

Specifications

For URI:

Documentation / Reference





Discover More
(HTTP|HTTPS) - Hypertext Transfer Protocol

Hypertext Transfer Protocol (HTTP) is the transfer protocol to exchange or transfer web resource between nodes (host). The H in HTTP means an hypertext (ie HTML). The protocol was first designed...
A web resource is the data of the web

This articles shows what a web resource is, how to access it and how it's defined. Web resources is also known as web content. The most known web resource is an html page with its CSS and Javascript but...
Card Puncher Data Processing
Android - (HTTP|Net| URL )

Net, http supports on Android Android support/includes two HTTP clients HttpURLConnection (Droid Doc java/net/HttpURLConnection or Java doc java/net/HttpURLConnection) and the Apache HTTP Client...
Content Provider
Android - Content Provider

A content provider is a facade between the data store (Xml, Database) and the applications. Change the underlying data source without changing the application code Leverage standard android library....
Card Puncher Data Processing
Antlr - Parser Rule

in Antlr. Parser rule is the second type of rule for Antlr. They begin with a lowercase letter. The lexer rules specify the tokens whereas the parser rules specify the tree. URL URI See ...
Card Puncher Data Processing
Apache - URL Rewrite (mod_rewrite)

URL rewrite in Apache is done through the rewrite module. The rules are set in the htaccess file This module operates on the full URLs (including the path-info part) both: in per-server context (httpd.conf)...
Card Puncher Data Processing
Application - Addressing

Any method that helps locating a resource. see
Azure Storage Structure
Azure - Windows Azure Storage Blob (WASB) - HDFS

Windows Azure Storage Blob (WASB) is an file system implemented as an extension built on top of the HDFS APIs and is in many ways HDFS. The WASB variation uses: SSL certificates for improved security...
Oauth
Client Endpoint (Redirection URI | Redirection Endpoint | User Agent Redirection)

The client endpoint is an endpoint used by the authorization endpoint to return authorization responses containing authorization credentials to the client via the resource owner user-agent (typically a...
Email - Mailto Uri

mailto is an the schema of an opaque URI that defines an email address



Share this page:
Follow us:
Task Runner