A Quick Post on URL, URI, UDI, URN… Resources

URL, or Uniform Resource Locator, is often used as a blanket term for almost anything on the internet. A URI, or Uniform Resource Identifier, represents a unique resource on a server, located somewhere on the World Wide Web. Other abbreviations that are often confusingly related include UDI for Universal Document Identifier and URN for Universal Resource Name. All together we have the following abbreviations;

  • URL – Uniform Resource Locator
  • URI – Uniform Resource Identifier
  • UDI – Universal Document Identifier
  • URN – Uniform Resource Name

A URI can be either a URL or URN.

URI Syntax

scheme:[//authority]path[?query][#fragment]
  • Scheme – This is a non-empty sequence of characters followed by a colon, followed by any combo of digits, letters, periods, hyphens, or plus characters. The scheme is registered with the Internet Assigned Numbers Authority (IANA).
  • Authority – The authority is an optional field preceded by //. It has the following subfields.
    • Userinfo – A subcomponent which could contain username and password, or other user information data.
    • Host – A subcomponent containing either an IP address or a registered host or domain name.
    • Port – An optional subcomponent that is followed by a colon.
  • Path – Contains a sequence of segments separated by a slash characters. This could be something like /resources or /trains or similar.
  • Query – An optional component preceded by a question mark. The component contains a query string of non-hierarchical data, each parameter is separated by an ampersand in the query component and parameter values are assigned using an equals operator.
  • Fragment – An optional field and is preceded by a hash. The fragment includes a fragment identifier for a secondary resource.

Examples

  • mailto:myaddress@thrashingcode.com
  • telnet://10.20.0.1:23/
  • ldap://[2020:ba6:9:9]/c=ZAZA?objectClassOfDomain?objectOfDomain

The Differentiator

The URI examples above all could be called URLs, however the difference is that a URI is an identifier, where as a URL is an identifier and provides details on how to get to the identified resource.

URN AKA Uniform Resource Name

URNs are not used often. More specific details can be found in RFC 2141. For this quick post it’s safe to sort of ignore URNs, as the other abbreviations are the ones you will see out and about in the world, and specifically used in detailing REST APIs and the like.