REST API Design

Difficulty
Importance

The problem

Once a server can respond to requests, its interface needs to be predictable enough that clients (including ones you'll never meet) can guess how to use it correctly — REST is a set of conventions for organizing an API around resources and standard HTTP methods so its shape becomes learnable, not arbitrary.

Why now

Building an HTTP server showed how to respond to any request, but not how to design a coherent set of them. REST supplies that missing design discipline — a convention for mapping types-and-values' idea of 'a thing with a type' onto URLs and HTTP methods in a consistent, predictable way.

Mental model

REST models everything as a resource (a noun, addressed by a URL) acted on by a small, fixed set of standard verbs (the HTTP methods) instead of inventing a new verb for every action. GET /orders/42 always means 'give me order 42,' never 'do something to it' — that discipline is what makes an unfamiliar REST API guessable from its URL structure alone.

Requires

Unlocks

Used in

Projects

  • Design and implement a REST API for a small domain (e.g. a bookshelf) with proper resource URLs and HTTP methods for create/read/update/delete
  • Take a poorly designed API (verbs in URLs, inconsistent methods) and redesign it following REST conventions, explaining each change

Examples

  • POST /orders creates a new order; GET /orders/42 retrieves it; PATCH /orders/42 updates it; DELETE /orders/42 removes it — one URL, four standard verbs
  • GET /getUserData?id=42 violates REST conventions by encoding an action ('get') into the URL instead of using the GET method itself

Resources

Mastery checklist