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.
3 points to say:
- Plural nouns, 1–2 levels of nesting; URLs reflect the business model and never expose internal service names.
- A bulk-add endpoint must pick all-or-nothing (
422for the batch) or partial success (a result per item). - 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.