What is REST?
REpresentational State Transfer (REST) is a software architectural style that defines the constraints to create web services. The web services that follows the REST architectural style is called RESTful Web Services. It differentiates between the computer system and web services. The REST architectural style describes the six barriers.
1. Uniform Interface
The Uniform Interface defines the interface between client and server. It simplifies and decomposes the architecture which enables every part to be developed. The Uniform Interface has four guiding principles:
A client-server interface separates the client from the server. For Example, the separation of concerns not having an internal relationship with internal storage for each server to improve the portability of customer's data codes. Servers are not connected with the user interface or user status to make the server simpler and scalable. Servers and clients are independently replaced and developed until the interface is changed.
Stateless means the state of the service doesn't persist between subsequent requests and response. It means that the request itself contains the state required to handle the request. It can be a query-string parameter, entity, or header as a part of the URI. The URI identifies the resource and state (or state change) of that resource in the unit. After the server performs the appropriate state or status piece (s) that matters are sent back to the client through the header, status, and response body.
Example, the data stored in a database. Consider the application state of having data that may vary according to client and request. The resource state is constant for every customer who requests it.
4. Layered system
It is directly connected to the end server or by any intermediary whether a client cannot tell. Intermediate servers improve the system scalability by enabling load-balancing and providing a shared cache. Layers can enforce security policies.
On the World Wide Web, customers can cache responses. Therefore, responses clearly define themselves as unacceptable or prevent customers from reusing stale or inappropriate data to further requests. Well-managed caching eliminates some client-server interactions to improving scalability and performance.
6. Code on Demand (optional)
The server temporarily moves or optimizes the functionality of a client by logic that it executes. Examples of compiled components are Java applets and client-side scripts.
Compliance with the constraints will enable any distributed hypermedia system with desirable contingency properties such as performance, scalability, variability, visibility, portability, and reliability.
Note: The optional lock of the REST architecture is Code on Demand. If a service violates a constraint, it cannot be strictly referenced.