REST – Universal Identifier

Finally, REST architecture relies on resource identifiers that are: unique, unambiguous, universal across the system and universally accessible regardless of context. Put more simply, identifiers should provide a way to access a resource from anywhere in a consistent fashion as long as the resource is available.

These identifiers are typically URIs, URLs, and URNs. URIs (Uniform Resource Identifiers) can be classified as locators (URLs [Uniform Resource Locators]), as names (URNs [Uniform Resource Names]), or as both. A URN functions like the scientific names given to plants, animals, and compounds. A URL provides an address like those used to identify homes, businesses and websites. Stated concisely: the URN defines an item’s unique identity, while the URL provides a method for finding it.

Note that REST does not require the identifier to be human readable. The ASN.1 OID 1.3.6.1 is as valid as the latin name Candida Albicans for describing a unique object or resource. However, since systems are built, used and maintained primarily by people, many RESTful systems devote a significant amount of time to crafting readable resource identifiers.  For example, Instagram uses a hierarchy in crafting readable URLs for their API. Retrieving the photos you have liked is accomplished by calling  users/self/media/liked using Instagram’s public API. In short: resources should be easily and uniquely referenced via resource identifier’s that may or may not be easy to decipher.

Leave a Reply

Your email address will not be published. Required fields are marked *