Bundle
The Bundle resource is a container for a collection of resources and optionally additional info
Please start a discussion or contact us if you have questions, feedback, or suggestions.
The Bundle resource is a resource which groups multiple resources in one. It is important to differentiate Bundle resource and operation which take or return Bundles.
Let's look at some operations working with Bundle resources.
POST /,POST /fhir
Main article: Transactions.
This operation accepts Bundle resource (with type batch or transaction); executes contained requests; then returns Bundle resource in response (with type batch-response or transaction-response).
OperationPOST /accepts and return Bundle in Aidbox format; operationPOST /fhiraccepts and returns Bundle in FHIR format.GET /<resourceType>,GET /fhir/<resourceType>
Main article: fhir-search
This operation searches for resource of typeresourceTypeusing search parameters provided in query string, and returns Bundle resource (with typesearchset) containing all resources matching the given filters.GET /<resourceType>/<id>/_history,GET /fhir/<resourceType>/<id>/_history
Main article: history.md
This operation returns the Bundle resource (with typehistory) containing previous versions of the specified resource.GET /<resourceType>/_history,GET /fhir/<resourceType>/_history
Main article: history.md
This operations returns the Bundle resource (with typehistory) containing previous versions of resources with the specified type.- CRUD operations with Bundle resource
Main article: crud
These are the usual FHIR CRUD operations with Bundle resource. They only store/update/get/search Bundle resources without additional semantics.
These operations are rarely used.
Examples:POST /Bundle,GET /Bundle,GET /Bundle/<id>,PUT /Bundle,POST /fhir/Bundle,GET /fhir/Bundle,GET /fhir/Bundle/<id>,PUT /fhir/Bundle/<id>
See more about the difference between Aidbox and FHIR formats (/... and /fhir/... endpoints) in the aidbox-and-fhir-formats.md page.
POST / , POST /fhir endpoint
Aidbox supports FHIR batch and transaction interactions, as well as some additional options to this endpoint.
Same as with other endpoint, POST / accepts and returns Bundle in Aidbox format,
while POST /fhir accepts and returns Bundle in FHIR format.
POST /
content-type: text/yaml
accept: text/yaml
resourceType: Bundle
type: <type>
...
Behavior of the endpoint depends on the type of a bundle resource provided in a request body.
Supported type values:
transaction
Executes provided rest requests in a transaction.
In case of an entry execution error the whole transaction is rolled back and the error is returned in the response.
Returnstransaction-responsetype bundle.batch
Executes provided rest requests, execution doesn't stop on error, all results and errors are returned in the response.
Returnsbatch-responsetype bundle.collection
Works the same way as thebatchtype, but doesPUT /<resourceType>/<id>for each resource in entry.
Returnsbatch-responsetype bundle.
Validate Bundle
To validate bundle without storing it content, use Bundle/$validate operation.
POST /fhir/Bundle/$validate
content-type: application/json
accept: application/json
{
"resourceType": "Bundle",
"type": "message",
// ...
}
In fhir-schema-validator mode, /fhir/Bundle/$validate doesn't validates Aidbox built-in resources (User, AccessPolicy, etc.).
Use validation in Aidbox format with Bundle/$validate if you need to validate a bundle with built-in resources. This endpoint only validates entries of the bundle, but not the bundle itself.