December 2019
Intermediate to advanced
510 pages
11h 33m
English
We already discussed the theory around the HATEOAS principle in Chapter 1, REST 101 and Getting Started with ASP.NET Core. This section explains how to implement the HATEOAS approach for the ItemController already present in the Catalog.API project. The following snippet of code shows an example of a generic HATEOAS response:
{ "_links": { "get": { "rel": "ItemsHateoas/Get", "href": "https://localhost:5001/api/hateoas/items", "method": "GET" }, "get_by_id": { "rel": "ItemsHateoas/GetById", "href": "https://localhost:5001/api/hateoas/items/8ff0fe8f-9dbc-451f-7a57-08d652340f56", "method": "GET" }, "create": { "rel": "ItemsHateoas/Post", "href": "https://localhost:5001/api/hateoas/items", "method": "POST" }, "update": { ...Read now
Unlock full access