Lesson 4 / 24

HTTP Methods & CRUD

Mapping create, read, update, delete onto HTTP verbs.

The core five

GET reads a resource. POST creates a new one (or triggers an action). PUT replaces a resource entirely. PATCH partially updates it. DELETE removes it. Picking the right verb communicates intent before anyone reads a body.

CRUD to HTTP

The classic mapping onto a single resource collection.

POST   /orders          -> Create
GET    /orders          -> Read (list)
GET    /orders/482      -> Read (one)
PUT    /orders/482      -> Update (replace)
PATCH  /orders/482      -> Update (partial)
DELETE /orders/482      -> Delete

Safe vs unsafe

GET and HEAD are safe — they must not change server state, so browsers, proxies, and crawlers can call them freely. Never do a delete or a write behind a GET.