The REST Constraints in Depth

Client-server: UI concerns and data concerns are separated.

Stateless: Every request contains the information required to process it. The server does not rely on conversational session state stored between requests.

Cacheable: Responses explicitly or implicitly indicate whether they may be cached.

Uniform interface: Resources are identified consistently, representations are transferred, messages are self-descriptive, and hypermedia can drive application state.

Layered system: A client does not need to know whether it is communicating directly with the origin server or through proxies, gateways, CDNs, and other intermediaries.

Code-on-demand: Servers may optionally transfer executable code to clients. This constraint is optional.

REST Constraint

Stateless

Each request is self-contained

Application session state should not be required on the server merely to understand a request.

Cacheable

Responses can be cached

Caching improves scalability and latency when correctness permits.

Layered

Intermediaries are allowed

CDNs, proxies, gateways, and load balancers can exist between client and server.

Uniform interface

Consistent interaction model

Resources, representations, messages, and hypermedia form a consistent interface.