Skip to main content

Patch Resource

The FHIR patch operation allows you to partially update an existing resource on the FHIR server. This is done using an HTTP PATCH request to the endpoint corresponding to the resource type and ID. FHIR supports both JSON Patch and FHIRPath Patch formats.

Patch a Patient resource using the Haste Health CLI:

haste-health api patch Patient 12345 --file patch.json

Where patch.json contains JSON Patch operations:

[
{
"op": "add",
"path": "/telecom",
"value": [
{
"system": "phone",
"value": "555-1234"
}
]
}
]

Replace [tenant] with your tenant name and [project] with your project ID.

Error Handling

If there are any issues with the request (e.g., resource not found, invalid patch operation), the server will respond with an appropriate error status code and include an OperationOutcome resource in the response body.

HTTP/1.1 400 Bad Request
Content-Type: application/fhir+json
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "invalid",
"diagnostics": "Invalid patch operation: path not found"
}
]
}