PUT
Cheat sheet · https://pcornel.dk/topic.php?topic=5297
Answer
Replacement or creation of the representation at a known resource URI with idempotent request semantics.
Remember
- PUT idempotent ≠ no change on repeated calls; the same intended representation may still update metadata or timestamps.
- PUT ≠ partial update by default; omitting fields can replace or reset state depending on the contract.
- 200/204 ≠ stored representation matches input; server normalization or policy may alter values.
- Known URI ≠ authorized target; caller scope and conditional concurrency still matter.
First checks
curl -sS -X PUT -H 'Content-Type: application/json' -d @full.json https://<api>/v1/items/<id>— replace- Full representation required — semantics
- ETag/If-Match for concurrency — lost update prevention
Verify in this order
PUT full object → resource replaced
Where it usually breaks
A successful PUT response proves request processing, not that omitted fields, concurrent changes or server normalization produced the intended final state.
Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.
PUT API boundary map
| 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 |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5297