I get a lot of traffic for my original article on RESTful and HATEOAS services, so I’ve decided to update and revise the article.
REST stands for Representational State Transfer. The main selling point of RESTful Services is that they are designed to be used on the internet using HTTP. It has the following constraints –
|PUT||Update or Create – Idempotent||PUT /customerservice/customers|
|PATCH||Update only – Idempotent||PATCH /customerservice/customers/1|
|DELETE||Remove record||DELETE /customerservice/customers/1|
The HTTP return codes are used for success/failure –
HATEOAS is an additional constraint on RESTful services. It requires the response to return the location of the data, and you can also return a list of other operations at that point. The advantage of this approach is that you can navigate the RESTful service model.
GET customerservice/customers/1 HTTP/1.1 HTTP/1.1 200 OK
Would have an additional link paramater to show its source –
<link rel=”self” href=”http://localhost:8080/customerservice/customers/1″ />