@rkenmi - HATEOAS

HATEOAS


July 17, 2021

HATEOAS


Back to Top

Updated on August 20, 2021

HATEOAS stands for Hypertext as the Engine of Application Source.

Basically what this means is that the REST APIs are augmented to give back more helpful information in the response (metadata, if you will), such as hyperlinks that help inform the client with things like navigation.

Example API Response

GET api/messages/3  
{
  "id": "3",
  "message": "Follow me on twitter",
  "date": "9-13-2013",
  "likesUri": "api/messages/3/likes",
  "sharesUri": "api/messages/3/shares"
}

The first 3 lines are from the original API response. The last 2 lines are augmented by HATEOAS to include helpful links that the user can take advantage of to navigate within this context.

Benefits include, but not limited to:

  • Richer, formatted response vs. the original response that includes:
    • Self-links - /api/employees/0
    • Links to the aggregate root - /api/employees/
  • Can be extended to use HAL forms to show the template of the API, give information on which fields are available or readonly, etc.

Article Tags:
RESThateoas