logo
logo

Links

Since the REST API of Sitecore Content Hub is a Hypermedia API, linking between resources plays a significant role. Any resource in the API can be reached from the service endpoint by following the right links.

The main reason is that clients (and even some servers) do not store the location of a representation with the representation. For example, if you wget http://.../foo.json, the representation will be saved to disk, but the URI at which it was fetched will not be. If there is no "self" link embedded in the representation, this causes two problems:

  1. Relative links in the document may no longer have a base against which to resolve, and will therefore be "broken"
  2. The client will have no embedded concept of where to e.g. PUT the document back to a server if they modify it.

It's important to understand that representations may have a life well outside the HTTP conversation, and may even be transferred via other protocols (e-mail, FTP, in a book, etc). Therefore, the Link Object is an important object present in almost every resource.

To learn more about the usage of the "self" link, please refer to this excellent article by Roy Fielding REST APIs must be hypertext-driven and these discussions on Stack Overflow: What is the importance of the self link in hypermedia APIs? and Link to another resource in a REST API: by its ID, or by its URL?

Can we improve this article ? Provide feedback

IN THIS ARTICLE