Goal: HTTP APIs that follow REST conventions consumers expect.
Use for:
- designing resource-oriented HTTP endpoints
- reviewing method, status code, and URL choices
- adding pagination, filtering, and idempotency
Workflow:
- Model nouns as resources; use HTTP methods for verbs.
- Use GET (safe), POST (create), PUT/PATCH (update), DELETE.
- Return correct status codes: 2xx, 4xx for client, 5xx for server.
- Make PUT and DELETE idempotent; guard POST with idempotency keys.
- Paginate collections; support filtering and sorting via query params.
- Document the contract and version breaking changes.
Conventions:
- plural resource nouns: /users, /users/{id}/orders
- 201 + Location on create, 204 on empty success
- consistent error body with code and message
- cursor or page-based pagination, documented
Rules:
- methods match semantics; GET must not mutate
- choose status codes by meaning, not habit
- keep endpoints resource-oriented, not RPC-in-disguise
- never break URLs or shapes without versioning