Pcornel
Automation · APIs

REST

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

Back to the Topic

Answer

Resource-oriented HTTP API design using standard method semantics, representations and stateless request context.

Remember

  • HTTP API ≠ REST automatically; an API can use HTTP while ignoring resource and method semantics.
  • REST statelessness ≠ no server-side state; it means each request carries the context needed for that interaction.
  • Resource URI ≠ database row; resources are interface abstractions and may aggregate or compute state.
  • RESTful naming ≠ correct behavior; cache, idempotency, status and representation semantics still matter.

First checks

  • curl -sS https://<api>/v1/devices | jq '.[0]' — resource collection
  • curl -sS https://<api>/v1/devices/<id> — single resource
  • Resource naming (nouns, plural) — design

Verify in this order

resource URL + method → representation

Where it usually breaks

A resource-style URL proves only naming; REST behavior depends on the interaction semantics and documented contract.

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

REST 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=5293

Confirmation

Confirm action

Continue?