REST Acronym for RE presentational S tate T ransfer. It is NOT A PROTOCOL It is an architectural style A Web API conforming to the REST architectural style is called a REST API (or RESTful API).
Guiding Principles These provides simplicity, scalability and statelessness. The six guiding principles or constraints are:
Principles Uniform Interface Identification of resources – unique identity Manipulation of resources through representations – uniform server response representations, used to modify resource state in server Self – descriptive messages – info. on message processing, additional information’s Client – Server Separation of concerns of client & server. Improves portability across platform Improves scalability by simplifying server components Make sure the client server interface doesn’t break
Principles Stateless Each client request must contain all necessary & complete request. Client application must keep the session state. Cacheable Responses should be labelled cacheable or non – cacheable. If cacheable, response data can be reused for a specified period. Layered System Hierarchical layers, each component can’t be seen beyond the layer they are interacting. Code on Demand (Optional) – reduces re - implementation
Resource Key abstraction of information Any information is a resource. Resource Representation – state of the resource. Resource Representations consist of Data Metadata Hypermedia links – helps client to transition to the next desired state.
Resource Resource Identifiers Used to identify each resource involved in the interactions between the client and server components Hypermedia Media type – data format of the representation RESTful API looks like a hypertext. Self – Descriptive Resource representations shall be self – descriptive. Client doesn’t need to know if resource is a device or an employee.