Uniform Resource Identifier (URI)
A Uniform Resource Identifier (URI) is a sequence of characters that refers to the identity of a resource, thereby allowing resources to be distinguished from one another. Resources can be differentiated based on their location on the internet, their name, or both.
URLs and URNs
A URI can distinguish between physical or logical resources that are available on the web. Resources can represent web pages and other electronic resources but also, can be used to identify people, places, objects, and even ideas or concepts.
A URI that also specifies the location of the resource is a Uniform Resource Locator (URL).
A URI that provides only a unique name for a resource, without details about where it can be found, is a Uniform Resource Name (URN).
The format of the URI syntax is as follows:
scheme : [// authority] path [? query] [# fragment]
Scheme is a required keyword that refers to a scheme that is registered by the Internet Assigned Numbers Authority (IANA). It is case-insensitive, begins with a letter, and is followed by any combination of letters, digits, the plus
-, or period
. characters. Some commonly used schemes are http, https, and ftp. The complete list of URI schemes is maintained by IANA.
Authority is an optional component that is prefixed by two slashes
//. It contains the userinfo, host, and port components.
Userinfo is an optional component that contains a username and optionally, a password. The syntax
username:password was commonplace before it was deprecated due to security concerns. If the userinfo component exists then it is followed by the at symbol
@ to indicate the start of the host.
The host represents either a registered name or an IP address. If the IP address is in the IPv4 format then it must be formatted using dot-decimal notation. IpV6-formatted IP addresses are required to be enclosed in brackets
Port is an optional component that indicates which port the host is available on. It is preceded with a colon
Path is a required component made up of a set of path segments, each delimited by a slash
/. Although the path is required for every URI, it can be zero-length, or empty. If a segment is empty then it will be denoted with two slashes
//, although this is not permitted if the authority is not included in the URI.
Query is an optional component that will be prefixed with a question mark
? if it is present. The query string is used by the client to specify data or instructions for the server, and will be of a format that is expected and/or specified by the server.
Fragment is an optional component that will be prefixed with a hash
# if it is present.