Pcornel
Automation · APIs

API Fundamentals

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

Back to the Topic

Answer

The core client/server contract of an API, including endpoint, resource, operation, representation and response semantics.

Remember

  • API reachable ≠ API usable; the contract, authentication, authorization and resource semantics may still fail.
  • HTTP success ≠ requested business outcome; asynchronous or validation behavior can defer the real result.
  • Endpoint documented ≠ endpoint implemented exactly; deployed version and environment can drift from documentation.
  • Machine-readable response ≠ trustworthy state; callers must validate schema, semantics and target-side effect.

First checks

  • curl -sS -i https://<api>/ — basic request
  • API documentation/OpenAPI — reference
  • Auth method — keys/tokens/OAuth

Verify in this order

request (method, URL, headers, body) → response (status, headers, body)

Where it usually breaks

A syntactically valid request and successful HTTP response prove only that the API interaction reached a defined response path; they do not independently prove the desired external state.

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

API Fundamentals 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=5292

Confirmation

Confirm action

Continue?