Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In our What is REST? article we introduced an important aspect of the Uniform Interface constraint known as HATEOAS. The intent of HATEOAS borrows the concept of HTML hyperlinks as a means of providing self-documented options to users. The difference is that HTML defines this as a standard which makes it possible for clients to interpret the hyperlinks automatically. Plain old JSON does not include any definition for hypermedia. This means any hypermedia included in a JSON object has no way of being self-interpreting. Clients cannot know the difference between a URI that is part of the static resource data (i.e., just plain media) versus a URI that clients can use to navigate to another resource (i.e., hypermedia).

HAL resolves this by extending JSON to include hypermedia and define the standard so clients can properly identify hypermedia within JSON objects. This is why the SRP HTTP Framework normally sets the Content-Type response header to application/hal+json instead of just application/json. It is important to note that HAL does not redefine JSON. This means clients can navigate and parse HAL content using the same rules as standard JSON.

...