HTTP Methods Cheat Sheet

Semantics, idempotency, and safe methods for designing clean REST APIs.

Core Methods

Key / CodeDescription
GETRead a resource. Safe and idempotent.
POSTCreate a resource or trigger processing. Not idempotent.
PUTReplace a resource. Idempotent.
PATCHPartially update a resource. Not necessarily idempotent.
DELETERemove a resource. Idempotent.
HEADSame as GET but no response body.
OPTIONSDiscover supported methods / CORS preflight.

Safe vs Idempotent

Key / CodeDescription
SafeDoes not modify server state (GET, HEAD, OPTIONS).
IdempotentRepeated calls have the same effect (GET, PUT, DELETE).

Common API Patterns

Key / CodeDescription
GET /usersList resources.
POST /usersCreate resource.
GET /users/{id}Fetch resource by ID.
PATCH /users/{id}Update part of a resource.
DELETE /users/{id}Delete resource.

Error Handling Tips

Use 400 for validation errors, 401/403 for auth, 404 for missing resources, and 409 for conflicts.

Knowledge is power.