Google News
logo
Java Spring Boot - Interview Questions
What is HATEOS in RESTful applications?
HATEOAS (Hypermedia as the Engine of Application State) is a principle for REST APIs, according to which the API should guide the client through the application by returning relevant information about potential subsequent steps, along with the response.
 
This information is in the form of hypermedia links included with responses, which helps the client to navigate the site's REST interfaces. It essentially tells the clients what they can do next, and what is the URI of the resource. If a service consumer can use the links from the response to perform transactions, then it would not need to hardcode all links.
 
According to the Richardson Maturity Model, HATEOAS is considered the final level of REST.
 
To support HATEOAS, each resource in the application should contain a "links" property which defines hyperlinks to related resources. 
 
Each link object typically includes the following properties :
 
* "rel”: Relation with the target resource.
 
* "href”: URI for resource
 
For example :
{
 "contractId": 10067,
 "description": "Contract details for the requested orderId",
 "status": "created",
 "links": [
 {
"rel": "self",
    "href": "http://demoApplication.com/contracts/10067"}]
 }

 

Advertisement