Use it when configuring, checking or troubleshooting APIs.
APIs
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.
1. APIs are the preferred automation interface over screen scraping or CLIs.
2. Authenticate, handle pagination, rate limits and errors.
3. Idempotent operations where possible.
4. Version and document with OpenAPI.
5. Log request IDs.
client → HTTPS → auth → endpoint → JSON response
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
caller intent → endpoint/version → authn/authz → method/path/query/headers/body → transport → server validation/operation → status/headers/body → target read-back
Healthy evidence: endpoint/version and request contract are explicit, credentials are scoped, correlation IDs join evidence and state-changing results are independently verified.
Step 2 Verify API automation with response identity and independent resource read-back Verify boundary
Capture the API method, normalized resource URI, response status, correlation/request ID and returned resource or task identifier. For an asynchronous operation, wait for the task to reach its documented terminal success state, then issue a read-only GET for the resource and verify the exact fields that should have changed. Repeat the request with the same idempotency or concurrency contract and confirm it does not create an unintended duplicate. A 200 or 202 response alone does not show the final resource state or downstream workload behavior.
Step 3 Failure modes and next checks Narrow the fault
Suspicious evidence: wrong environment/version, undocumented request shape, blind retries, leaked credentials, response-only success assumptions or target state contradicting the API response.
It does not show unrelated platform health or final business correctness. A valid API response shows the request reached a defined response path for that caller context, but it does not show the requested target or business state.
Next check: Continue from the first step that has not been verified: reproduce the exact request, verify endpoint/version and auth context, inspect status/headers/body plus correlation ID, reconcile retry/idempotency state, then re-read the target resource before retry or closure.
Step 4 Branch API failures by transport, auth, request contract and asynchronous task Narrow the fault
If an API call never receives HTTP, inspect DNS, TCP/TLS and proxy boundaries first. For 401/403, verify token identity, scope and resource authorization; for 400/422, compare method, URI, headers and schema field paths with the server error. For 404, distinguish wrong resource/version from eventual creation delay. For 409/412, inspect concurrency tokens or current resource version. For 429/5xx, honor Retry-After/backoff and correlate request IDs. If the API returns a task ID, poll that task before treating request acceptance as completed state.
Evidence · 2 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Healthy evidence: endpoint/version and request contract are explicit, credentials are scoped, correlation IDs join evidence and state-changing results are independently verified. Suspicious evidence: wrong environment/version, undocumented request shape, blind retries, leaked credentials, response-only success assumptions or target state contradicting the API response.
command output · Documented exampleREST API local healthy-state checkpointThe expected object, scope, state and counters match a controlled test.
Subtopics
Go one level deeper into this subject.
The core client/server contract of an API, including endpoint, resource, operation, representation and response semantics.
Subtopic RESTResource-oriented HTTP API design using standard method semantics, representations and stateless request context.
Subtopic HTTP MethodsThe semantic contract of HTTP methods used by APIs, especially safety, idempotency and expected resource effect.
Subtopic GETRetrieval of a current representation without intending to change server state.
Subtopic POSTSubmission of a representation or command that commonly creates a subordinate resource or triggers a non-idempotent action.
Subtopic PUTReplacement or creation of the representation at a known resource URI with idempotent request semantics.
Subtopic PATCHPartial modification of an existing resource using a documented patch document or field-update contract.
Subtopic DELETERequesting removal or deactivation of a resource while distinguishing accepted deletion from durable absence.
Subtopic HTTP Status CodesClassification of transport/application response outcomes using HTTP status codes together with API-specific error bodies and operation state.
Subtopic Request HeadersMetadata sent with an API request such as content negotiation, authorization, conditional state, tracing and client context.
Subtopic Response HeadersServer and intermediary metadata describing representation type, caching, pagination, throttling, resource location, concurrency and correlation.
Subtopic Query ParametersURL query components used for filtering, sorting, projection, search and pagination without changing the route identity.
Subtopic Path ParametersResource identifiers embedded in the URL path and resolved by routing rules before the operation executes.
Subtopic Request BodyThe structured representation or command payload submitted to an API operation.
Subtopic JSONJSON representation semantics for API payloads, including types, null, arrays/objects, numeric precision and schema validation.
Subtopic XMLXML representation semantics for APIs, including namespaces, encoding, schema validation and secure parser behavior.
Subtopic PaginationRetrieval of large result sets across multiple responses using page/offset or cursor/token mechanisms.
Subtopic Rate LimitingServer-side control of request frequency or quota by identity, token, tenant, endpoint or other scope.
Subtopic API VersioningEvolution of an API contract across URI, header, media-type or provider-specific version selectors and lifecycle states.
Subtopic AuthenticationProof of client or user identity to an API before authorization evaluates access to resources and operations.
Subtopic API KeysStatic or semi-static secret values used by APIs to identify and sometimes authorize a calling application or tenant.
Subtopic Basic AuthenticationHTTP Basic authentication using a username/password credential encoded for transmission and protected by TLS.
Subtopic Bearer TokensPossession-based access tokens transmitted with API requests and validated for lifetime, issuer, audience, scope and policy context.
Subtopic OAuth 2.0Delegated authorization framework for obtaining and using access tokens through defined grant flows and client roles.
Subtopic OpenAPIMachine-readable API contract describing operations, parameters, schemas, responses and security schemes for tooling and documentation.
Subtopic API TroubleshootingEvidence-first isolation of API failures from caller and endpoint selection through transport, authentication, request contract, server processing and target verification.
- 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.
curl -sS -i https://<api>/health— status and headerscurl -sS -H 'Authorization: Bearer <token>' https://<api>/v1/items | jq .— authenticated call- OpenAPI spec — contract
ReferenceWhat it is1 section · depth on demand
Core model
Model an API interaction from caller intent through endpoint/version selection, authentication and authorization, method/path/query/headers/body, transport, server routing/validation, operation execution, response status/headers/body and independent target read-back. The response is evidence of the API path, not automatic evidence of the requested external state.
ReferenceWhy it matters2 sections · depth on demand
When to use it
Use REST API when the problem concerns data models, APIs, code, orchestration, infrastructure as code, controllers or AI-assisted workflows.
API automation is a protocol contract plus resource-state contract
APIs used for automation combine transport/TLS, authentication, HTTP method and URI semantics, versioned schemas, rate limits and resource-specific state transitions. A 2xx response shows the server accepted or completed a request according to that API; asynchronous APIs may instead return a task identifier whose later state is authoritative. Pagination, idempotency keys, ETags/version fields and error bodies are part of the automation contract, not optional decoration. Client code should preserve request/correlation IDs without logging secrets or bearer tokens.
ReferenceImportant terms & boundaries3 sections · depth on demand
What this shows and what it does not
A valid API response shows the request reached a defined response path for that caller context, but it does not show the requested target or business state.
Key operational limits
- Desired state, source of truth, rendered change, apply result and realized infrastructure state are distinct
- Validate schema, identity, authorization, idempotency, error handling and partial failure
- Preview/diff, limit blast radius, verify read-after-write and preserve rollback/audit evidence
In depth
An API (Application Programming Interface) is a defined way for programs to talk to a system: which requests are allowed, what data they take and what they return. In automation, APIs replace screen-scraping CLI output with structured data (usually JSON) and predictable error codes.
| API style | Typical use |
|---|---|
| REST over HTTPS | Controllers, cloud platforms, SaaS tools |
| NETCONF/RESTCONF | Model-driven network device configuration |
| gRPC/gNMI | Streaming telemetry and high-performance calls |
| GraphQL | Querying exactly the fields you need (e.g. NetBox) |
| Webhooks | The system calls you when an event happens |
curl -s -H "Authorization: Bearer $TOKEN" https://netbox.example.com/api/dcim/devices/?site=oslo | jq '.results[].name'
Read the API's documentation for authentication, rate limits and pagination before scripting against it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Lowest-Good remediation source for APIs. Documentation authority supports bounded reference claims only; it is not observed lab/production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc9110 · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
APIs API boundary map
Fast request/delivery, trust, processing and verification boundaries for APIs.
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Caller / request | Environment/version, identity and exact request contract are attributable | Hidden defaults, wrong endpoint/version, leaked or mismatched credentials |
| Server / response | Status, headers, structured body and request ID are interpreted together | Status-only handling, ignored error body, ambiguous async result or unsafe retry |
| State / proof | Write result is reconciled with resource read-back or acceptance test | Response success treated as final target success without verification |
| Troubleshooting | First failed boundary is preserved, changed minimally and retested | Blind retries, credential rotation, replay or payload edits before evidence is captured |
REST API evidence chain
Configuration, operational state, counters and downstream proof remain separate.
| 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 |
Deep reference
Healthy vs suspicious evidence
Interpret HTTP status, headers, error payload and async result
API output interpretation starts with the HTTP status semantics, then selected headers and the resource/error body, and finally any asynchronous task/resource read-back. Do not collapse every 2xx into “success” or every non-2xx into the same retry path. Preserve request/correlation ID, method/URI, safe response headers, returned resource/task identity and concurrency/rate-limit metadata while redacting credentials and sensitive payload fields.
Synchronous error example:
HTTP/1.1 409 Conflict
Content-Type: application/json
X-Request-ID: 9f31...
ETag: "v17"
{"error":"version_conflict","current_version":17}
A 409 here says the request reached the application but conflicted with current resource state; refresh the resource/version and decide whether the intended mutation is still valid rather than retrying unchanged. For 401/403, branch to authentication versus authorization; for 400/422, use the structured validation path/message; for 429, honor rate-limit/Retry-After semantics; for 5xx, retain request ID and apply bounded retry only when method/idempotency semantics permit it.
Asynchronous acceptance example:
HTTP/1.1 202 Accepted
Location: /tasks/t-8821
X-Request-ID: a12c...
202 shows acceptance, not completion. Follow the task until a documented terminal state, then GET the intended resource and verify its version/fields. Pagination must also be interpreted: one page with HTTP 200 is not evidence that the full collection was processed. When ETag/version or idempotency keys are part of the contract, keep them with the result so concurrent changes and duplicate requests can be distinguished from transport retries.