You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

No, this is not a reference to the HAL 9000 from Clarke's 2001: A Space Odyssey,

Quick Answer

HAL is an acronym for Hypertext Application Language and is designed to provide "...a set of conventions for expressing hyperlinks in either JSON or XML." HAL is an IANA registered media type that enables RESTful APIs to return JSON (or XML) content with hypertext (aka hypermedia) that can be easily interpreted by machine and human agents. Because it is a registered media type, developers can specify application/hal+json as the value for the Content-Type response header.

Digging Deeper

In our What is REST? article we introduced an important aspect of the Uniform Interface constraint known as HATEOAS. The concept of HATEOAS borrows the concept of hyperlinks in the media (via the anchor tag) to provide self-documented state changes. The difference is that the HTML media type defines this hypermedia feature in its standard which makes it possible for clients to interpret the hyperlinks automatically. Plain old JSON (as well as XML) does not have any native hypermedia support. This means any hypermedia included in a JSON object has no self-interpreted meaning. Clients have to be told how to tell the difference between normal text versus hypermedia text for it to be useful.

This is why media types registered with the IANA exist. This provides a standards based mechanism for clients to reference.

 

  • No labels