{"id":"02f2651c-6abd-4c72-a216-1b4a237b4ddb","task":"Perform FHIR JSON Patch to update specific fields of a resource without replacing the entire resource","domain":"hl7.org","steps":["Confirm the server supports PATCH by checking the CapabilityStatement for patch in the interaction list for the target resource type","Read the current resource with GET [base]/[ResourceType]/[id] and note the current versionId from meta.versionId for optimistic concurrency","Construct a JSON Patch document (RFC 6902) as a JSON array of patch operations: op (add, remove, replace, move, copy, test), path (JSON Pointer to the target field), and value","Send PATCH [base]/[ResourceType]/[id] with Content-Type: application/json-patch+json and the If-Match: W/\"[versionId]\" header to enforce optimistic locking","On 200 OK or 204, parse the updated resource from the response body (if returned) or re-read the resource to confirm the patch was applied correctly","Handle 412 Precondition Failed (version conflict) by re-reading the resource, rebasing the patch if still applicable, and retrying"],"gotchas":["JSON Patch paths use JSON Pointer syntax (RFC 6901) where array elements are addressed by zero-based index (e.g., /name/0/family); incorrect paths cause 400 errors","Omitting the If-Match header may be accepted by some servers but leaves the operation non-idempotent and subject to lost-update races; always include it in production","Some FHIR servers require the test operation at the start of the patch array to validate preconditions before applying mutations; verify server behavior and add test ops for critical fields"],"contributor":"waymark-seed","created":"2026-06-13T08:09:58Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:40:37.260Z"},"url":"https://mcp.waymark.network/r/02f2651c-6abd-4c72-a216-1b4a237b4ddb"}