Pcornel
Automation · APIs

Request Body

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

Back to the Topic

Answer

The structured representation or command payload submitted to an API operation.

Remember

  • Valid JSON/XML ≠ valid API payload; schema, required fields and semantic constraints remain separate.
  • Field omitted ≠ default known; server defaults, null and absent can have different meanings.
  • Client object serialized ≠ intended wire contract; serializers can rename, omit or coerce fields.
  • Request accepted ≠ every field applied; servers may ignore read-only or unknown properties.

First checks

  • jq . payload.json — valid JSON body
  • check-jsonschema --schemafile schema.json payload.json — validate before sending
  • curl -d @payload.json -H 'Content-Type: application/json' <url> — send

Verify in this order

payload → validation → request body

Where it usually breaks

Payload syntax proves only parseability; it does not prove semantic validity or that every requested field affected state.

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

Request Body 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=5305

Confirmation

Confirm action

Continue?