CRUD describes operations on data. REST describes how to expose those operations over HTTP. They map almost one-to-one.
| CRUD | HTTP Verb | Example Route | Typical Status |
|---|---|---|---|
| Create | POST | POST /tasks | 201 Created |
| Read (list) | GET | GET /tasks | 200 OK |
| Read (one) | GET | GET /tasks/42 | 200 OK / 404 |
| Update (full) | PUT | PUT /tasks/42 | 200 OK |
| Update (partial) | PATCH | PATCH /tasks/42 | 200 OK |
| Delete | DELETE | DELETE /tasks/42 | 204 No Content |
REST treats data as resources addressed by nouns, not verbs:
✅ GET /tasks
✅ POST /tasks
✅ DELETE /tasks/42
❌ GET /getTasks
❌ POST /createTask
❌ GET /deleteTask?id=42
The HTTP method is the verb. The URL is the noun. Don't put verbs in the path.
Two properties matter when designing CRUD endpoints:
GET is safe.GET, PUT, and DELETE are idempotent; POST is not.POST /tasks (twice) → creates TWO tasks (not idempotent)
PUT /tasks/42 (twice) → same final state (idempotent)
DELETE /tasks/42 (twice) → gone after first call (idempotent)
Designing with these properties in mind makes retries, caching, and offline sync far safer.
We'll dig into the difference — and when each matters — in Chapter 6.