PATCH
Cheat sheet · https://pcornel.dk/topic.php?topic=5298
Answer
Partial modification of an existing resource using a documented patch document or field-update contract.
Remember
- PATCH ≠ idempotent automatically; semantics depend on the patch format and operation.
- Partial update ≠ isolated change; server validation or derived fields can affect adjacent state.
- Missing field ≠ null/delete unless the patch format defines it that way.
- Successful PATCH ≠ merged state understood; the resulting full resource must be re-read.
First checks
curl -sS -X PATCH -H 'Content-Type: application/merge-patch+json' -d '{"enabled":false}' https://<api>/v1/items/<id>— partial update- JSON Patch vs Merge Patch — format
- Idempotency of the patch — retry safety
Verify in this order
PATCH changes → partial update
Where it usually breaks
PATCH success proves the patch was processed according to the server contract; it does not prove adjacent fields remained correct.
Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.
PATCH 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=5298