Skip to main content

3.2. Links

Another common practice is assuming that the server's URI structure is well-known and can be calculated by the client. This can be seen in specifications that make requirements upon the presence, syntax, and semantics of URI components and subcomponents.

While this makes using such APIs convenient, it also tightly couples the client to the server. That coupling can become a liability (e.g., when the server wants to change how URIs are allocated).

A more flexible approach is to use links embedded in representations or in header fields (e.g., Link or Location). This way, the client doesn't need to know the structure of the server's URI space; it only needs to understand how to discover the relevant link and dereference it. This is sometimes referred to as "hypermedia as the engine of application state" or "HATEOAS".

See [WEB-LINKING] for more information and [RFC8288] for the Link header field.