REST Architectural Constraints

All six REST constraints from Fielding's dissertation with definition and the implication each one has

Reference for the six REST architectural constraints — client-server, stateless, cacheable, uniform interface, layered system and code on demand — with Roy Fielding's definition and the practical implication of each.

What are the six REST constraints?

Client-server, stateless, cacheable, uniform interface, layered system, and code on demand. The first five are required for an interface to be RESTful; code on demand is the only optional one. They come from Roy Fielding's 2000 doctoral dissertation that defined the REST architectural style.

REST (Representational State Transfer) is not a protocol or a format — it is an architectural style defined by Roy Fielding in his 2000 dissertation. An interface earns the label “RESTful” only by satisfying a set of constraints. This reference lists all six with Fielding’s definition and the trade-off each imposes.

How it works

REST is defined by six constraints, applied on top of a network of components. Five are required; one (code on demand) is optional:

  1. Client–Server — separate UI from data storage.
  2. Stateless — each request is self-contained; no server-side session.
  3. Cacheable — responses declare their cacheability.
  4. Uniform Interface — URIs, representations, self-descriptive messages, HATEOAS.
  5. Layered System — components only see the adjacent layer.
  6. Code on Demand (optional) — server may send executable code to clients.

Each constraint buys a property — scalability, visibility, simplicity — usually at some cost in efficiency or latency.

Example

The stateless constraint is why a REST API authenticates every request with a token rather than a server-held session. Because no instance needs to remember the caller, a load balancer can route consecutive requests to different servers freely, and you can add or remove instances without sticky sessions. The trade-off is that the token and context travel on every request.

Notes

  • The uniform interface is what most distinguishes REST from RPC; its HATEOAS sub-constraint (hypermedia links driving state) is the part most APIs omit.
  • Layered system is what makes transparent caches, gateways and load balancers possible — clients can’t tell whether they’re talking to the origin.
  • Satisfying all required constraints yields the scalability and evolvability REST is prized for; violating statelessness or the uniform interface is what quietly turns a “REST” API into something else.