Relationship and difference between HAL and HATEOAS

24,722

HATEOAS is a concept of application architecture. It defines the way in which application clients interact with the server, by navigating hypermedia links they find inside resource models returned by the server.

To implement HATEOAS you need some standard way of representing resources, that will contain hypermedia information (links to related resources), for example, something like this:

{
    "links": {
        "self": { "href": "http://api.com/items" },
        "item": [
            { "href": "http://api.com/items/1" },
            { "href": "http://api.com/items/2" }
        ]
    },
    "data": [
            { "itemName": "a" }, 
            { "itemName": "b" } 
    ] 
}

HAL is one of such standards. It is a specific format of resource presentation, that can be used to implement HATEOAS.

You can fully implement HATEOAS without following HAL at all if you prefer to follow another standard or use your own.

Share:
24,722

Related videos on Youtube

Lee Chee Kiam
Author by

Lee Chee Kiam

Updated on July 08, 2022

Comments

  • Lee Chee Kiam
    Lee Chee Kiam almost 2 years

    HATEOAS (Hypermedia as the Engine of Application State) and HAL (Hypertext Application Language) seem to be related but are not exactly the same. What is the relationship and difference between HATEOAS and HAL?

  • Lee Chee Kiam
    Lee Chee Kiam over 9 years
    Besides HAL, what are standards you are aware of?
  • astreltsov
    astreltsov over 9 years
    There's collection+json and at least a couple of others
  • RAM
    RAM over 5 years
    There is also collection+JSON, JSON-LD, and the use of link headers.