freecoding.school100% FREE · NO SIGNUP
Endpoint BayISSUE #4 of 45

http methods · GET · POST · PUT · PATCH · DELETE

RestaVSThe 401 Bandit
Resta saysHTTP methods express intent: GET reads, POST creates, PUT/PATCH update, DELETE removes.

The method is the verb. GET retrieves (no side effects, safe to repeat); POST creates or triggers an action; PUT replaces a whole resource; PATCH partially updates; DELETE removes. GET and PUT/DELETE are idempotent (repeating is safe); POST usually isn't. Matching method to intent makes an API predictable.

Power-ups you unlock

The 401 Bandit attacks — common mistakes

Boss battleAssign the right method to: fetch a user, create one, rename one, remove one.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>GET    /users/42     read
POST   /users        create
PATCH  /users/42     update name
DELETE /users/42     remove</pre></body></html>
▶ Open the interactive comic issue
‹ Http Basics · Request · ResponseHttp Status Codes · 2xx · 3xx · 4xx · 5xx ›