Rest (Representational State Transfer) is an architectural style for
the web application.
A restful web service is nothing but a service that follows the below six important constraints that defines a rest architecture.
Client Server Separation
The Client and Server has individual responsibilities to do. The client's involvement is not needed for the server to perform any of its task and vice versa. So they are independently serviceable .
Stateless Communication between client and server
The client sends any request to the server with all the information embedded within the request itself
and the server provides the response based on the request and no state is maintained i.e no other information is retained by either the client or the server.
Cache-able
The response from server should indicate to the server if the information is cache able or not. This way the client can use the cached data and need not request the server for repetitive data.
Code on demand
The Server can optionally send piece of code to the client, where it can be executed in order to extend the functionality of the Client.
Layered System
The Rest based system can have multiple layers in it, including the client and many layers of server.
But each layer has knowledge as well as interaction only with the adjacent layers.
Uniform Interface
Interface separates from implementation and this is accomplished with the below four sub constraints of any rest architecture.
Resource Identification
The action of sending requests and receiving responses done by the client acts as an interface for the restful architecture. The request to get any resource is identified by the URI and the response is always received in any of the formats like HTML, JSON and XML. This doesn't have any dependency on how the data is stored or manipulated on the server side, which is considered as the implementation from server end. In this way, this constraint allows to achieve the Uniform interface constraint.
Operation control of resources by client
The client can perform any change to the resources on the server with the help of the HTTP methods and URI.
Independent messages
Any request sent by the client doesn't have any dependency on any other requests generated by the client. Each request is complete on its own to get the necessary response from the server.
HATEOAS (Hypermedia as the engine of application state)
This constraint provides a paradigm that whenever a client sends a request to the server, the server should provide not only the requested information, but all the possible related end points in the form of links to the client.
A restful web service is nothing but a service that follows the below six important constraints that defines a rest architecture.
Client Server Separation
The Client and Server has individual responsibilities to do. The client's involvement is not needed for the server to perform any of its task and vice versa. So they are independently serviceable .
Stateless Communication between client and server
The client sends any request to the server with all the information embedded within the request itself
and the server provides the response based on the request and no state is maintained i.e no other information is retained by either the client or the server.
Cache-able
The response from server should indicate to the server if the information is cache able or not. This way the client can use the cached data and need not request the server for repetitive data.
Code on demand
The Server can optionally send piece of code to the client, where it can be executed in order to extend the functionality of the Client.
Layered System
The Rest based system can have multiple layers in it, including the client and many layers of server.
But each layer has knowledge as well as interaction only with the adjacent layers.
Uniform Interface
Interface separates from implementation and this is accomplished with the below four sub constraints of any rest architecture.
Resource Identification
The action of sending requests and receiving responses done by the client acts as an interface for the restful architecture. The request to get any resource is identified by the URI and the response is always received in any of the formats like HTML, JSON and XML. This doesn't have any dependency on how the data is stored or manipulated on the server side, which is considered as the implementation from server end. In this way, this constraint allows to achieve the Uniform interface constraint.
Operation control of resources by client
The client can perform any change to the resources on the server with the help of the HTTP methods and URI.
Independent messages
Any request sent by the client doesn't have any dependency on any other requests generated by the client. Each request is complete on its own to get the necessary response from the server.
HATEOAS (Hypermedia as the engine of application state)
This constraint provides a paradigm that whenever a client sends a request to the server, the server should provide not only the requested information, but all the possible related end points in the form of links to the client.
No comments:
Post a Comment