Profiles & Operations Index > Interaction: FHIR Batch Query
Interaction: FHIR Batch Query
A FHIR batch query involves sending multiple FHIR API requests within a single HTTP request, improving efficiency and reducing network traffic. It utilizes a FHIR Bundle resource with the Bundle.type set to batch. For MI use cases, since FetchDocumentReference is not available in the first release, this query should be used to retrieve multiple MI data entities in one call.
The batch query should be following these requirements:
- Bundle Structure: The requests are encapsulated within a FHIR Bundle resource. Each individual request (e.g., a search, create, update) is an entry within the bundle.
- Independent Processing: Each entry within a batch bundle is treated as an independent operation. The success or failure of one entry does not impact the others.
- HTTP POST: Batch requests are typically submitted using an HTTP POST command to the base URL of the FHIR server.
- Request Details: Each entry in the bundle includes Bundle.entry.request details, specifying the HTTP method (e.g., GET, POST) and the URL for the individual action. If the method is POST, the entry will also contain the resource to be created or updated.
- Batch Response: The server responds with a Bundle resource containing the individual responses for each request within the original batch.
In summary, MI batch query should use a bundle that consists of three entries, where each entry contains the search query specified in the IG.
Example of batch query
POST [base]
Body:
{
"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"request": {
"method": "GET",
"url": "ServiceRequest?{parameters}"
}
},
{
"request": {
"method": "GET",
"url": "DiagnosticReport?{parameters}"
}
},
{
"request": {
"method": "GET",
"url": "ImagingStudy?{parameters}"
}
}
]
}