Batch
Submitting batch bundles (designated by batch on Bundle.type) allows you to submit sets of actions. These actions, unlike terminology, are non-atomic (an error occurring in one operation will not prevent other actions from being applied on the server). Use batch if you want to evaluate multiple actions in a single request but don't care or do not want all actions to fail if one fails.
API
R4
- CLI
- Curl
- Typescript
iguhealth api batch r4 --data '$MY_BATCH_BUNDLE'
curl --request POST --header "Authorization: Header" --header "Content-Type: application/fhir+json" --data '$MY_BATCH_BUNDLE' ${domain}/w/${tenant}/api/v1/fhir/r4
await client.batch({}, R4, batchBundle);
R4B
- CLI
- Curl
- Typescript
iguhealth api batch r4b --data '$MY_BATCH_BUNDLE'
curl --request POST --header "Authorization: Header" --header "Content-Type: application/fhir+json" --data '$MY_BATCH_BUNDLE' ${domain}/w/${tenant}/api/v1/fhir/r4b
await client.batch({}, R4B, batchBundle);
Example
The following is a batch bundle with two operations one that creates a Patient and another that creates a Practitioner.
- Request
- Response
{
"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"request": {
"method": "POST",
"url": "Patient"
},
"resource": {
"resourceType": "Patient"
}
},
{
"request": {
"method": "POST",
"url": "Practitioner"
},
"resource": {
"resourceType": "Practitioner"
}
}
]
}
{
"resourceType": "Bundle",
"type": "batch-response",
"entry": [
{
"response": {
"status": "201",
"location": "Patient/4841d13e-c830-4741-b07c-e918c5d26122"
},
"resource": {
"id": "4841d13e-c830-4741-b07c-e918c5d26122",
"meta": {
"extension": [
{
"url": "https://iguhealth.app/version-sequence",
"valueInteger": 157
},
{
"url": "https://iguhealth.app/author",
"valueString": "public-user"
}
],
"versionId": "157",
"lastUpdated": "2023-10-19T21:40:43.517+00:00"
},
"resourceType": "Patient"
}
},
{
"response": {
"status": "201",
"location": "Practitioner/ebd6d7c0-5fa5-48fd-b0b6-1cff03bfbd34"
},
"resource": {
"id": "ebd6d7c0-5fa5-48fd-b0b6-1cff03bfbd34",
"meta": {
"extension": [
{
"url": "https://iguhealth.app/version-sequence",
"valueInteger": 158
},
{
"url": "https://iguhealth.app/author",
"valueString": "public-user"
}
],
"versionId": "158",
"lastUpdated": "2023-10-19T21:40:43.517+00:00"
},
"resourceType": "Practitioner"
}
}
]
}