HTTP Methods
Cheat sheet · https://pcornel.dk/topic.php?topic=5294
Answer
The semantic contract of HTTP methods used by APIs, especially safety, idempotency and expected resource effect.
Remember
- Method name ≠ server behavior; an implementation can violate standard method semantics.
- Idempotent method ≠ identical response every time; state may remain stable while metadata or status differs.
- Safe method ≠ authorization-free; read operations can still expose sensitive information.
- Allowed method ≠ valid operation for every resource; route and resource state still constrain use.
First checks
curl -X OPTIONS -i https://<api>/v1/items— allowed methods- Safe (GET/HEAD) vs unsafe methods — semantics
- Idempotent methods (GET, PUT, DELETE) — retry safety
Commands
GET- HTTP method that reads a resource without changing it.
POST- HTTP method that creates a resource or triggers an action.
PUT- HTTP method that replaces a whole resource.
PATCH- HTTP method that changes parts of a resource.
DELETE- HTTP method that deletes a resource.
Verify in this order
method → semantics → server action
Where it usually breaks
The selected method communicates intended semantics but does not prove the server implemented those semantics correctly.
Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.
HTTP Methods API boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Caller / request | Environment/version, identity and exact request contract are attributable | Hidden defaults, wrong endpoint/version, leaked or mismatched credentials |
| Server / response | Status, headers, structured body and request ID are interpreted together | Status-only handling, ignored error body, ambiguous async result or unsafe retry |
| State / proof | Write result is reconciled with resource read-back or acceptance test | Response success treated as final target success without verification |
| Troubleshooting | First failed boundary is preserved, changed minimally and retested | Blind retries, credential rotation, replay or payload edits before evidence is captured |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5294