Skip to main content

Transactions

As stated previously, transaction bundles are atomic, meaning that if one action fails, all actions will fail. Additionally, transaction bundles allow you to reference resources that have been created in the same transaction. Meaning you can create a Patient and then reference that Patient in a Practitioner (or other resource within the Bundle).

Resolving entry dependencies

To reference a resource that has been created in the same transaction, you must use the fullUrl property on the entry. This property is used to reference the resource in the same transaction. The following example will demonstrate how to reference a resource in the same transaction.

Example

In this example, we will create two resources: a Patient and a Practitioner. The Patient will reference the Practitioner created in this transaction using the fullUrl property. This reference will be stored in the Patient's generalPractitioner property.

{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"fullUrl": "urn:oid:2",
"request": {
"method": "POST",
"url": "Patient"
},
"resource": {
"resourceType": "Patient",
"generalPractitioner": [
{
"reference": "urn:oid:1"
}
]
}
},
{
"fullUrl": "urn:oid:1",
"request": {
"method": "POST",
"url": "Practitioner"
},
"resource": {
"resourceType": "Practitioner",
"name": [
{
"given": ["Bob"]
}
]
}
}
]
}

Limitations

We currently limit transaction bundle size to 20 entries. This is to prevent users from submitting large transactions that may take a long time to process.