Transaction interaction allows performing several interactions using one http request. There are two types of transaction interaction (type is specified by field type
): batch and transaction. The first one just executes requests one by one, the second one does the same, but roll backs all changes if any request fails.
POST [base]
The body of such request contains one resource of type Bundle, which contains field entry with an array of interactions, for example (taken from Getting Started with SPA tutorial):
POST /type: transactionentry:- resource:id: adminemail: "admin@mail.com" # Change this valuepassword: "password" # Change this valuerequest:method: POSTurl: "/User"- resource:id: SPAredirect_uri: http://localhost:4200request:method: POSTurl: "/Client"- resource:engine: json-schemaschema:type: objectrequired:- userrequest:method: POSTurl: "/AccessPolicy"
Each element of the entry array contains a resource field (body of the request) and a request field (request line in terms of HTTP request).
resource: # not needed for DELETE and GET# resource herefullUrl: "something-here" # needed if you want to refer# the resource inside bundlerequest:method: POST # POST/GET/PUT/DELETEurl: "/ResourceType" # request url
Transaction interaction is processed in the order provided in a bundle, each interaction is executed one by one. It differs from the FHIR transaction processing rules.
For type: batch
references to resources inside a bundle won't be resolved.
For type: transaction
before processing interactions, all references in a resource will attempt to resolve. In this example ProcedureRequest will refer to ф newly created patient:
POST /type: transactionentry:- resource:resourceType: PatientfullUrl: urn:<uuid-here>request:method: POSTurl: "/Patient?_identifier=mrn:123"- resource:resourceType: Encounterstatus: proposalsubject:uri: urn:<uuid-here>request:method: POSTurl: "/Encounter"
You can provide a full Url with value like "urn:<uuid-here>"
and reference to the resource created by such interaction using ref: {uri: "urn:<uuid-here>"}
. Those references are temporary and will be translated to valid Aidbox references, when interaction entry is processed by a server.
You SHALL NOT refer resource, which is created later using conditional operations!