APIs
Cheat sheet · https://pcornel.dk/topic.php?topic=775
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 headerscurl -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
| Boundary | Question | Evidence | Does not prove |
|---|---|---|---|
| Definition | What is configured or intended? | running configuration / controller policy | live operation |
| Local state | Is the feature active at the expected scope? | GET <resource-uri> | remote success |
| Counters | Did controlled traffic or an event reach this stage? | scoped counters/timestamps | complete return path |
| Next boundary | What consumes or transports this state? | source of truth/input → schema/model → authentication/authorization → plan/diff → controlled execution → task/result → realized-state assertion | application success |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=775