Pcornel
Automation · APIs

HTTP Methods

Cheat sheet · https://pcornel.dk/topic.php?topic=5294

Back to the Topic

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

BoundaryHealthy evidenceSuspicious evidence
Caller / requestEnvironment/version, identity and exact request contract are attributableHidden defaults, wrong endpoint/version, leaked or mismatched credentials
Server / responseStatus, headers, structured body and request ID are interpreted togetherStatus-only handling, ignored error body, ambiguous async result or unsafe retry
State / proofWrite result is reconciled with resource read-back or acceptance testResponse success treated as final target success without verification
TroubleshootingFirst failed boundary is preserved, changed minimally and retestedBlind 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

Confirmation

Confirm action

Continue?