Bundle

Please start a discussion or Contact us 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: transaction.md.\
  • This operation accepts Bundle resource (with type batch or transaction); executes contained requests; then returns Bundle resource in response (with type batchresponse or transactionresponse).\
  • Operation POST / accepts and return Bundle in Aidbox format; operation POST /fhir accepts and returns Bundle in FHIR format.
  • GET /, GET /fhir/\
  • Main article: search1\
  • This operation searches for resource of type resourceType using search parameters provided in query string, and returns Bundle resource (with type searchset) containing all resources matching the given filters.
  • GET ///_history, GET /fhir///_history\
  • Main article: history1.md\
  • This operation returns the Bundle resource (with type history) containing previous versions of the specified resource.
  • GET //_history, GET /fhir//_history\
  • Main article: history1.md\
  • This operations returns the Bundle resource (with type history) containing previous versions of resources with the specified type.
  • CRUD operations with Bundle resource\
  • Main article: crud1\
  • 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/, PUT /Bundle,\
  • POST /fhir/Bundle, GET /fhir/Bundle, GET /fhir/Bundle/,\
  • PUT /fhir/Bundle/

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.

yaml
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.\
  • Returns transactionresponse type bundle.
  • batch\
  • Executes provided rest requests, execution doesn't stop on error, all results and errors are returned in the response.\
  • Returns batchresponse type bundle.
  • collection\
  • Works the same way as the batch type, but does PUT // for each resource in entry.\
  • Returns batchresponse type bundle.

Validate Bundle

To validate bundle without storing it content, use Bundle/$validate operation.

json
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.