Interview Questions

HATEOAS (Hypertext as the Engine of Application State)

HATEOAS (Hypertext as the Engine of Application State)

It is a constraint in REST based architecture, to provide HREF links to resources as part of rest api response.
By this way , the user can navigate to subsequent resources provided by the REST service.

{
       "id": "47cc4ae4-648c-4fc4-ae26-4ad8e90bdeca",
       "username": "CraigJ",
       "email": "craig.jonathan@tdd.com",
       "password": "password",
       "firstName": "Craig",
       "lastName": "Jonathan",
       "isPasswordGotReset": true,
        "links": [ {
            "rel": "self",
            "href": "http://localhost:8080/user/47cc4ae4-648c-4fc4-ae26-4ad8e90bdeca"
        } ],
     "links": [ {
        "rel": "user.search",
        "href": "http://localhost:8080/user/search"
    } ]  
   },

The above code is user response returned from REST GET api. It consist of self reference link to the same api and also the url to search users.