Handbooks / REST API Design / Chapter 2
Resource Design
7 pages · ~5 min✓ Reviewed
Builds on HTTP Methods and Status Codes. Next up: Authentication and Authorization.
REST Mental Model and Constraints
1. Resources
- Everything is a resource (a noun) at a URI
- Clients exchange representations (usually JSON) of its state
2. Six Constraints
- Client-server: UI and data split
- Stateless: each request carries all context (token, params)
- Cacheable: responses declare it
- Uniform interface: standard verbs and URIs
- Layered system: proxies, gateways
- Code-on-demand: optional
Stateless
No server session between calls: any server can answer, so you scale horizontally.
3. Methods
| Method | Use | Safe | Idempotent |
|---|---|---|---|
GET | read | yes | yes |
POST | create | no | no |
PUT | replace | no | yes |
PATCH | partial update |