Representational state transfer

What Is Representational State Transfer?

Representational state transfer (REST) is an architectural style for designing distributed network-based systems, particularly web services, that emphasizes stateless communication between clients and servers through a uniform interface centered on resources. Roy Fielding introduced REST in his 2000 doctoral dissertation at the University of California, Irvine, in which he derived the style by identifying and relaxing constraints that would produce the scalability, simplicity, and evolvability observed in the World Wide Web. The dissertation, Architectural Styles and the Design of Network-based Software Architectures, remains the primary reference for the constraints that define a RESTful system.

REST is not a protocol or a standard but an architectural style: a set of guiding principles that, when applied, produce systems with predictable properties. Its influence on web API design has been pervasive since the mid-2000s, and the term "RESTful API" now describes the dominant pattern for web service interfaces across software industry practice.

Core Architectural Constraints

Fielding identified six constraints that together define REST. The statelessness constraint requires that each client request contain all information needed to process it; the server retains no session context between requests, which simplifies server implementation and improves horizontal scalability. The client-server separation constraint decouples the user interface from data storage concerns, allowing each to evolve independently. Cacheability requires responses to declare whether they may be stored by clients or intermediaries, enabling performance improvements without protocol modifications. The layered system constraint allows intermediary components such as load balancers, content delivery networks, and gateways to exist between client and server without either endpoint needing to be aware of their presence. Two additional constraints apply in specific contexts: a uniform interface across all interactions, and the optional code-on-demand principle that allows servers to extend client functionality by transferring executable scripts.

Resources and Uniform Interface

The central abstraction in REST is the resource, defined as any conceptual entity that can be named. A resource might be a document, a collection of records, a sensor reading, or a user account. Each resource is identified by a uniform resource identifier (URI), which gives it a stable address independent of its current representation. When a client requests a resource, the server returns a representation, typically a JSON or XML document, rather than the resource itself. This separation between the abstract resource identity and its concrete representation is what the name "representational state transfer" describes: the client receives, and may modify, a representation of the resource's state. Interacting with resources through a small set of standard operations, primarily the HTTP methods GET, POST, PUT, DELETE, and PATCH, forms the uniform interface that distinguishes REST from earlier approaches that exposed arbitrary remote procedure calls. The IETF HTTP specification maintained at the IETF datatracker defines the semantics of these methods in detail.

REST in Practice

In practice, REST APIs are the standard mechanism through which web applications, mobile clients, and third-party developers interact with platform services. A RESTful API for a social platform might expose resources at paths such as /users/{id} and /posts/{id}/comments, accepting HTTP requests with JSON bodies and returning JSON responses. Adherence to REST constraints varies widely: many APIs labeled RESTful are partial implementations that omit hypermedia controls (HATEOAS), the most demanding constraint, which would allow clients to discover available actions from links embedded in responses rather than relying on out-of-band documentation. The IEEE Computer Society's coverage of web services standards documents ongoing research into API design, versioning, and governance practices that affect how REST principles are applied in production systems.

Applications

Representational state transfer has applications in a range of fields, including:

  • Cloud platform APIs exposing compute, storage, and database services to developers
  • Mobile application backends serving data to iOS and Android clients
  • Microservices architectures where independently deployable services communicate over HTTP
  • Internet of Things systems where devices report state and receive commands via lightweight REST endpoints
  • Open data portals through which government agencies and research institutions expose public datasets
Loading…