Skip to main content

Update Resource

The FHIR update operation allows you to update an existing resource on the FHIR server. This is done using an HTTP PUT request to the endpoint corresponding to the resource type and ID.

Examples

Update a Patient resource using the Haste Health CLI:

haste-health api update Patient 12345 --file updated-patient.json

Where updated-patient.json contains:

{
"resourceType": "Patient",
"id": "12345",
"name": [
{
"use": "official",
"family": "Smith",
"given": ["John"]
}
],
"gender": "male",
"birthDate": "1980-01-01",
"telecom": [
{
"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 data), 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 phone number format"
}
]
}