HATEOAS

HATEOAS stands for “Hypertext As The Engine Of Application State”

It’s a constraint in the Rest architecture. By using which we can add the details of our API such as service link in the actual response. So the user can easily navigate through the response and he/she can easily identify the underlying services or other dependent services.

Refer the below example,


{
	"name": "Bala",
	"age": "45",
	"links": [{
		"rel": "self",
		"href": "http://localhost:8080/api/customers/1"
	}, {
		"rel": "address",
		"href": "http://localhost:8080/api/customers/1/address"
	}]
}

Assume that the you have received the above response while accessing the service http://localhost:8080/api/customers/1

Here, the links elements will provide some information about the underlying services. So to access the address information of this customer, we should access http://localhost:8080/api/customers/1/address service. This is an example of HATEOAS response

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s