SteelReed

Search

Search posts, questions…

Web & REST APIQuestion 11 / 25

Middle

How do you design good REST resource URLs, and what does stateless mean in REST?

Short answer

A URL is a plural noun naming a resource (/orders/123/items), the action is the HTTP method, nested at most 1–2 levels. Stateless means each request carries everything needed to handle it, with no session in an instance's memory.

request + tokenload balancerinstance Ainstance Bshared DB, Redis

3 points to say:

  1. Plural nouns, 1–2 levels of nesting; URLs reflect the business model and never expose internal service names.
  2. A bulk-add endpoint must pick all-or-nothing (422 for the batch) or partial success (a result per item).
  3. Using a database is still stateless because state lives in shared storage; the violation is a session in one instance's heap.

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.