Pcornel
Automation

APIs

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

Back to the Topic

Answer

APIs are machine-to-machine contracts that expose resources or operations through versioned endpoints, authentication, structured requests and responses. Reliable automation treats transport, identity, request semantics, server processing and target state as separate proof boundaries.

Remember

  • API reachable ≠ API contract correct; routing and transport can succeed while version, auth or schema is wrong.
  • HTTP response ≠ target outcome; accepted, asynchronous and partial operations require follow-up verification.
  • Authentication ≠ authorization; a recognized caller can still be denied a resource or operation.
  • Retryable error ≠ safe replay; method and operation idempotency must be understood before retry.

First checks

  • curl -sS -i https://<api>/health — status and headers
  • curl -sS -H 'Authorization: Bearer <token>' https://<api>/v1/items | jq . — authenticated call
  • OpenAPI spec — contract

Verify in this order

client → HTTPS → auth → endpoint → JSON response

Where it usually breaks

A valid API response proves the request reached a defined response path for that caller context; it does not independently prove the requested target or business state.

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

REST API evidence chain

BoundaryQuestionEvidenceDoes not prove
DefinitionWhat is configured or intended?running configuration / controller policylive operation
Local stateIs the feature active at the expected scope?GET <resource-uri>remote success
CountersDid controlled traffic or an event reach this stage?scoped counters/timestampscomplete return path
Next boundaryWhat consumes or transports this state?source of truth/input → schema/model → authentication/authorization → plan/diff → controlled execution → task/result → realized-state assertionapplication success

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=775

Confirmation

Confirm action

Continue?