Bundle. The client can submit an FHIR Patch document as part of a Bundle entry, enabling the server to perform partial updates on specified resources during transaction execution.Bundle.entry.resource. If JSON Patch is used, the patch content usually needs to be encapsulated within a Binary resource before being placed into the entry resource. The entry request method is fixed as PATCH.Parameter Name | Type | Required | Description |
HTTP Method | String | Yes | Fixed to POST. |
URL | String | Yes | The Bundle submission URL, usually [baseUrl]. |
Authorization | String | Yes | The authentication token, in the format Bearer <AccessToken>. The AccessToken is obtained via the GetAccessToken API in Calling Methods (or via the GetWebAccessToken API in the instance console scenario). |
Content-Type | String | No | The MIME type of the request body. For write-type requests, it is typically application/fhir+json; if not specified, the server will automatically infer it based on the request content. |
Request Body | JSON Object | Yes | A transaction Bundle containing Patch entries. |
Field | Type | Required | Description |
resourceType | String | Yes | Fixed as Bundle. |
type | String | No | Processing mode. Valid values are transaction (transactional mode, where all entries are executed as an atomic transaction, and a failure in any entry triggers a full rollback) or batch (batch mode, where each entry is executed independently without affecting others). |
entry | Array | Yes | A list of Patch entries. |
entry[].resource | Object | Yes | The content of the FHIR Patch document. When FHIR Patch is used, it is the Parameters resource, containing the patch operation type, path, and value; when JSON Patch is used, the patch content must be encapsulated within a Binary resource. |
entry[].request.method | String | Yes | Fixed as PATCH. |
entry[].request.url | String | Yes | The path of the resource to be patched, in the format [resourceType]/[id], for example, Patient/123. |
200 OK is typically returned. The response headers contain the content type and request trace information, and the response body is usually a result Bundle that includes the execution status of each entry and resource version information.Parameter Name | Type | Description |
Status Code | Integer | Returns 200 OK when successful. |
Location | String | The URL of the Bundle response resource, in the format [baseUrl]/Bundle/[bundleId]. |
Content-Location | String | The URL of the current version of the Bundle response resource. |
Content-Type | String | The MIME type of the response body, typically application/fhir+json. |
x-request-id | String | Request trace ID. |
Field | Type | Description |
resourceType | String | Returns the resource type, usually Bundle. |
id | String | Unique identifier of the Bundle resource. |
type | String | The type of the response Bundle. It returns transaction-response in transaction mode and batch-response in batch mode. |
link | Array | A list of link information, containing navigation links related to the current Bundle. |
link[].relation | String | The type of link relation, such as self (pointing to the current request address). |
link[].url | String | Link address. |
entry | Array | Execution results of each Patch entry. |
entry[].response.status | String | Execution status of the Patch operation. |
entry[].response.location | String | Location of the updated resource. |
entry[].response.etag | String | Resource version identifier. |
entry[].response.outcome | Object | Details of the operation outcome, containing the OperationOutcome resource, which describes the specific result information of the entry execution. |
POST /INSTANCE_ID/fhir HTTP/1.1Host: HOSTNAMEAuthorization: Bearer YOUR_ACCESS_TOKENContent-Type: application/fhir+json
{"resourceType": "Bundle","type": "transaction","entry": [{"resource": {"resourceType": "Parameters","parameter": [{"name": "operation","part": [{ "name": "type", "valueCode": "replace" },{ "name": "path", "valueString": "Patient.gender" },{ "name": "value", "valueCode": "male" }]},{"name": "operation","part": [{ "name": "type", "valueCode": "replace" },{ "name": "path", "valueString": "Patient.identifier" },{ "name": "value", "valueIdentifier": { "system": "http://new-system", "value": "0001" } }]}]},"request": { "method": "PATCH", "url": "Patient/__PID__" }}]}
HTTP/1.1 200 OKLocation: https://HOSTNAME/INSTANCE_ID/fhir/Bundle/<BUNDLE_ID>Content-Location: https://HOSTNAME/INSTANCE_ID/fhir/Bundle/<BUNDLE_ID>Content-Type: application/fhir+jsonx-request-id: <REQUEST_ID>
{"resourceType": "Bundle","id": "<BUNDLE_ID>","type": "transaction-response","link": [{"relation": "self","url": "https://HOSTNAME/INSTANCE_ID/fhir"}],"entry": [{"response": {"status": "200 OK","location": "Patient/123/_history/2","etag": "2","outcome": {"resourceType": "OperationOutcome","issue": [{"severity": "information","code": "informational","details": {"coding": [{"system": "https://hapifhir.io/fhir/CodeSystem/hapi-fhir-storage-response-code","code": "SUCCESSFUL_PATCH","display": "Patch succeeded."}]},"diagnostics": "Successfully patched resource \\"Patient/123/_history/2\\"."}]}}}]}
Error Code | Description |
400 Bad Request | Malformed patch document, or invalid patch path. |
401 Unauthorized | Not authenticated, and valid credentials are missing. |
403 Forbidden | Authenticated but not authorized to perform Patch operations. |
404 Not Found | The target resource in the entry does not exist. |
422 Unprocessable Entity | The Patch syntax is correct, but it fails business or rule validation. |
500 Internal Server Error | Internal server processing exception. |
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback