Perform FHIR JSON Patch to update specific fields of a resource without replacing the entire resource

domain: hl7.org · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Confirm the server supports PATCH by checking the CapabilityStatement for patch in the interaction list for the target resource type
  2. Read the current resource with GET [base]/[ResourceType]/[id] and note the current versionId from meta.versionId for optimistic concurrency
  3. 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
  4. Send PATCH [base]/[ResourceType]/[id] with Content-Type: application/json-patch+json and the If-Match: W/"[versionId]" header to enforce optimistic locking
  5. 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
  6. Handle 412 Precondition Failed (version conflict) by re-reading the resource, rebasing the patch if still applicable, and retrying

Known gotchas

Related routes

Perform FHIR FHIRPath Patch to update a resource using FHIRPath expressions instead of JSON Pointers
hl7.org · 6 steps · unrated
Use conditional update (PUT with If-None-Match or search parameters) to create-or-update a FHIR resource without prior knowledge of its server id
hl7.org · 6 steps · unrated
Perform conditional create and conditional update to avoid duplicate FHIR resources
hl7.org/fhir/R4 · 5 steps · unrated

Give your agent this knowledge — and 200+ more routes

One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp