The term, ‘Representational State Transfer’, comes from a dissertation published by Roy Fielding, one of the main developers of many different web standards. In abstract form, the computer scientist describes the underlying architecture of the World Wide Web (HTTP protocol, HTML and XML, parser, web and application servers, etc.). Generally speaking, REST’s architecture does not depend on any specific protocols. At the center of this concept lie resources, which, according to Fielding, must meet the following requirements:
- Addressability: each resource, e.g. an order, a product, or an article, must be able to be identified through a unique resource identifier (URI).
- Unified interfaces: every resource must be easily and uniformly accessible with the help of standard methods. For example, through HTTP methods, like ‘GET’, ‘POST’, or ‘PUT’.
- Client-server structure: generally, the client-server principle is applicable: A server provides a service that’s able to be requested by clients when needed.
- Statelessness: communication between servers and clients is stateless. This means that all exchanged messages contain all the information required for understanding them. The server doesn’t save any additional information between any two messages in the form of sessions. And given that incoming requests can be redistributed with the help of a load balancing scheme, statelessness makes REST services very easy to scale up.
- Different representations of resources: every web resource may feature multiple display formats. Depending on what the client requests, these resources may need to be delivered in different languages or formats like HTML, JSON, or XML.
- Hypermedia: resources are made available via hypermedia, e.g. in the form of ‘href’ and ‘src’ attributes in HTML documents. They can also be provided for defined interfaces of JSON or XML. Consequently, a REST-API’s client navigates according to the ‘hypermedia as the engine of application state’ (HATEOAS) method exclusively via URLs that have been provided by the server; these don’t require any additional information about the interface.
The strict standards of REST’s architecture enable services to be developed that communicate via a common protocol (HTTP), are well structured, and are easy to integrate.