REST and resource modeling
coreintermediateREST models an API as nouns (resources — /orders, /users/42) manipulated by a small, uniform set of HTTP methods, instead of one URL per action (/getOrder, /createOrder) — resource modeling is the design skill of choosing what counts as a resource and how they nest.
Think of it as
A REST API is a filing cabinet, not a phone menu. A phone menu ("press 1 to create an order, press 2 to cancel one") needs a new option for every new action. A filing cabinet has one drawer per NOUN (orders, users), and you act on a drawer's contents with the same handful of verbs (open, replace, remove) no matter which drawer it is.
What we're doing: Show a genuinely non-CRUD action ("cancel an order") modeled as a sub-resource creation instead of inventing a verb-shaped endpoint — the concrete resolution to REST's most common design question.
- 2
- The verb-shaped endpoint only supports one operation — there is nowhere for a GET to go to check cancellation status later.
- 7
- Modeling cancellation as a noun (a "cancellation" resource) means GET /orders/4821/cancellation is now a coherent, addressable follow-up question.
{'method': 'POST', 'path': '/orders/4821/cancel'}
{'method': 'POST', 'path': '/orders/4821/cancellation'}Why this works: Both style choices technically work for the POST itself, but only the noun-based path (/cancellation) fits into REST's uniform verb set for free — a later requirement like "let clients check if an order was cancelled" becomes a natural GET on the same path with the resource style, and requires an entirely new, differently-shaped endpoint with the verb style.
- Action style (avoid)
- POST /createOrder
- POST /cancelOrder?id=4821
- A new endpoint per action
- Resource style (REST)
- POST /orders
- POST /orders/4821/cancellation
- The same uniform verbs, every noun
Nesting resources more than two levels deep
Wrong
Better
What you see: Client code accumulates a chain of IDs it has to fetch and thread through just to build one URL — a task can never be looked up directly, only reached by walking the whole ownership chain first.
Why: Deep nesting conflates "how this resource is currently organized" with "how to address it" — a resource with its own stable, globally unique ID (a task) should be reachable directly by that ID, with query parameters (not more path nesting) used to filter or scope a collection.
Action-style vs. resource-style URLs
Remember: Model nouns (resources), not verbs — a genuinely non-CRUD action still becomes a sub-resource (POST .../cancellation), and nesting should stay at most 2 levels deep.
See also: http methods · pagination filtering sorting and search

