HATEOAS is an abbreviated form of Hypermedia As The Engine Of Application State. It is the approach of the REST application architecture that keeps the RESTful style architecture unique from most other network application architectures. It provides a connection through hypermedia.The Hypermedia term is used for any content that contains links to other forms of media such as text, images, and movies.
Why HATEOAS ?
Whenever we explore any web page in addition to the informative data, it also gives us the links of available actions we can perform. If we think about the typical REST API – it will return the data in response based on the request. So, the thought comes in our mind how it would be if something similar to the web page can happen in REST API so we can explore the API without prior knowledge of the entire API document and URL Structure.
Here, the HATEOAS comes with the approach to build the REST API where the user can dynamically explore the available actions they can perform at runtime from the server. All the User need is the initial URL. REST architectural style lets the developer use hypermedia links in the response contents so that the user can dynamically navigate to the appropriate resource through the hypermedia links. conceptually the same as a web user browsing through web pages by clicking the relevant hyperlinks to achieve a final goal.
Once the Initial URL is loaded, All the Upcoming application state transitions will be held by a user selecting from the choices provided by the server based on the state of an application at that time.
Let’s go through the simple example for the employee object and the response for the Simple REST service and HATEOAS Service for the same API call.
Response from HATEOAS Service
So, in the above example, you can see the HATEOAS service Response with the referral links with the various activities available for the state of an employee at that time like person, membership, and self. If no membership is available for an employee then it will not return the link of membership.
The “rel” stands for the relationship that gives information about how the link relates to the requested object. And “href” gives the action URL that describes how the action can be performed. So, Basically HATEOAS = Data + Links.
With all the above information i am sure you must have the basic idea of the HATEOAS service. If you still have any queries, we are here to help you. Take a tour of the services provided by us and get in touch.