Hands-On RESTful Web Services with TypeScript 3
上QQ阅读APP看书,第一时间看更新

HATEOAS

HATEOAS is a way that the client can interact with the response by navigating within it through the hierarchy in order to get complementary information.

For example, here the client makes a GET call to the order URI :

GET https://<HOST>/orders/1234

The response comes with a navigation link to the items within the 1234 order, as in the following code block:

{
id : 1234,
any-other-json-fields...,
links": [
{
"href": "1234/items",
"rel": "items",
"type" : "GET"
}
]
}

What happens here is that the link fields allow the client to navigate until 1234/items in order to see all the items that belong to the 1234 order.