BuildRestAPI — Modern REST API Engineering Logo
BuildRestAPI
Track: beginner7 min readUpdated 2026-10-04

What is a REST API? The Architectural Blueprint

Demystifying Roy Fielding's 6 architectural constraints, the request-response cycle, and why most REST APIs are actually HTTP RPC.

Introduction: Moving Beyond Toy Definitions

Most online tutorials define a REST API simply as “sending JSON over HTTP using GET and POST.” While common, that definition misses the architectural magic that makes REST the backbone of the global web.

In 2000, Roy Fielding introduced REST (REpresentational State Transfer) in his doctoral dissertation to explain how the World Wide Web operates without centralized coordination.

When you master true REST, you build APIs that are stateless, infinitely cacheable at edge CDNs, and decoupled from client UI changes.


The 6 Architectural Constraints of REST

To be truly RESTful, an API system must satisfy six foundational architectural constraints:

1. Client-Server Architecture

The user interface concerns (frontend, mobile apps) are decoupled from data storage concerns (database, server logic). This allows clients to evolve independently across platforms (iOS, Android, React, CLI) without altering the backend schema.

2. Statelessness (The Golden Rule)

Every request from client to server must contain all the information necessary to understand and process the request.

  • The server never stores session state in local memory between calls.
  • If request A goes to Server 1 and request B goes to Server 2, both succeed seamlessly.
  • Authentication credentials (e.g. JWT Bearer tokens) are passed on every individual request.

3. Cacheability

Responses must implicitly or explicitly define themselves as cacheable or non-cacheable. Using standard HTTP headers like Cache-Control: public, max-age=3600 and ETag, browsers and edge CDNs (like Cloudflare) can cache identical responses, reducing server load by up to 90%.

4. Layered System

A client cannot ordinarily tell whether it is connected directly to the end server, or to an intermediary along the way (such as a reverse proxy, load balancer, or API gateway like Cloudflare or Kong).

5. Uniform Interface

This is the central differentiating feature of REST:

  • Identification of Resources: Resources are named with URIs (/v1/customers/cust_123).
  • Manipulation of Resources Through Representations: Clients hold a representation of a resource (e.g. JSON) and modify it by sending verbs (PATCH, PUT).
  • Self-descriptive Messages: Each message includes its metadata (Content-Type: application/json).
  • HATEOAS (Hypermedia As The Engine Of Application State): Returning hypermedia links inside response payloads to guide the client on valid next actions.

6. Code on Demand (Optional)

Servers can temporarily extend client functionality by transferring executable code (e.g. JavaScript or WebAssembly).


The Anatomy of an HTTP Request

When your client executes an API call, it sends a structured ASCII stream over a TCP/TLS or QUIC socket:

POST /v1/users HTTP/2
Host: api.buildrestapi.com
User-Agent: curl/8.5.0
Authorization: Bearer sk_live_99214ab
Content-Type: application/json
Accept: application/json, application/problem+json

{
  "name": "Alex Mercer",
  "email": "[email protected]",
  "role": "engineer"
}

Components Breakdown:

  1. Method & Path: POST /v1/users identifies the action and target resource collection.
  2. Protocol Version: HTTP/2 provides multiplexing over a single connection.
  3. Headers: Key-value pairs communicating metadata (Auth, Content-Type, Caching).
  4. Body / Payload: The serialized representation being transferred.

Anatomy of the Server Response

A well-designed REST server responds with precise status semantics and RFC standards:

HTTP/2 201 Created
Date: Mon, 05 Oct 2026 03:00:00 GMT
Content-Type: application/json; charset=utf-8
Location: /v1/users/usr_883a01
ETag: W/"user_hash_99a"
X-RateLimit-Remaining: 99

{
  "id": "usr_883a01",
  "name": "Alex Mercer",
  "email": "[email protected]",
  "role": "engineer",
  "created_at": "2026-10-05T03:00:00Z"
}

Notice the Location header pointing directly to the canonical URI of the newly created resource!


Key Takeaways

  • REST is an architectural style, not a rigid protocol or framework.
  • Statelessness enables infinite horizontal scaling behind load balancers.
  • HTTP headers (Cache-Control, ETag, Location) are first-class citizens in production REST.
Quick Jump:
↑ ↓ to navigate↵ to select
BuildRestAPI Search Engine