This post aims to explain the following :
– What are REST architectural principles ?
– What is HATEOAS ?
Here are the architectural principle in REST :
In REST, URIs are used to address a resource.
Each HTTP request must contain URI of the object whose state is being accessed or updated.
Uniform and Constrained interface:
In REST, we only use the methods of HTTP for our service such as :
GET : access a resource
PUT : add resource
Reference books, you may like:Programming WCF Services: Design and Build Maintainable Service-Oriented Systems
WCF Multi-Layer Services Development with Entity Framework, 4th Edition
Learning WCF: A Hands-on Guide
DELETE : removes resource
POST : modify the resource
HEAD : similar to HEAD, but returns a response code along with any headers present
OPTIONs: request information about communication of resource
REST services are representation oriented and representation are transfered between the client and service.
The representations can be text, xml, html, json etc
With a GET operation, the client receives the current state of the resource.
A PUT or POST passes representation of a resource to the server, so that the underlying resource’s state can change.
REST services are stateless by nature. So, the clients state can not be stored on the server.
However, the client can still maintain state and pass it to the service with each request.
HATEOAS concept is Hypermedia As The Engine Of Application State.
Its about using hypermedia and hyperlinks for providing complex information through the service.
Hyperlinks allow us to reference and aggregate additional data without bloating the service response.
For example, if your service returns different products, then rather than sending all the products in the response, it can send 5/10 products and then provide a link that would request for the next set of products.
This makes the response lite and the service flexible.
© 2015, admin. All rights reserved.