Pcornel
Automation · APIs

POST

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

Back to the Topic

Answer

Submission of a representation or command that commonly creates a subordinate resource or triggers a non-idempotent action.

Remember

  • POST accepted ≠ action completed; 202 or asynchronous workflows can defer the real outcome.
  • POST retry ≠ safe automatically; duplicate creates or repeated side effects are common without an idempotency key.
  • 201 Created ≠ representation validated by the caller; Location and body still need checking.
  • Same payload ≠ same operation; server-generated identity or current state can change the result.

First checks

  • curl -sS -X POST -H 'Content-Type: application/json' -d @payload.json https://<api>/v1/items — create
  • 201 Created + Location header — result
  • Idempotency-Key header (if supported) — safe retry

Verify in this order

POST body → server creates → 201 + Location

Where it usually breaks

POST success proves only that the server accepted or processed that submission path; it may not prove a unique or completed side effect.

Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.

POST 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=5296

Confirmation

Confirm action

Continue?