You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api-1/transaction.md
+38-39Lines changed: 38 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -6,45 +6,35 @@ description: Do multiple operations in one call
6
6
7
7
### Introduction
8
8
9
-
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.
9
+
Transaction interaction allows for 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 executes requests one by one, and the second one does the same but rolls back all changes if any request fails.
10
10
11
11
```
12
12
POST [base]
13
13
```
14
14
15
-
The body of such request contains one resource of type Bundle, which contains field entry with an array of interactions, for example:\\
15
+
The body of such a request contains one resource of type Bundle, which contains field entry with an array of interactions, for example:
Each element of the entry array contains a resource field (body of the request) and a request field (request line in terms of the HTTP request).
@@ -62,14 +52,14 @@ request:
62
52
63
53
### Processing rules and Conditional refs
64
54
65
-
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](https://www.hl7.org/fhir/http.html#trules).
55
+
Transaction interactions are processed in the order provided in a bundle; each interaction is executed one by one. This differs from the FHIR transaction [processing rules](https://www.hl7.org/fhir/http.html#trules).
66
56
67
57
For `type: batch` references to resources inside a bundle won't be resolved.
68
58
69
-
For `type: transaction` before processing interactions, all references in a resource will attempt to resolve. In this example ProcedureRequest will refer to a newly created patient:
59
+
For `type: transaction` before processing interactions, all references in a resource will attempt to resolve. In this example, ProcedureRequest will refer to a newly created patient:
70
60
71
61
```yaml
72
-
POST /
62
+
POST /fhir
73
63
Accept: text/yaml
74
64
Content-Type: text/yaml
75
65
@@ -86,55 +76,64 @@ entry:
86
76
resourceType: Encounter
87
77
status: proposal
88
78
subject:
89
-
reference: urn:uuid:<uuid-here>
79
+
uri: urn:uuid:<uuid-here>
90
80
request:
91
81
method: POST
92
82
url: "/Encounter"
93
83
```
94
84
95
-
You can provide a full Url with value like `"urn:<uuid-here>"` and reference to the resource created by such interaction using ref: `{reference: "urn:<uuid-here>"}`. Those references are temporary and will be translated to valid Aidbox references when interaction entry is processed by a server.
85
+
You can provide a full URL with values 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.
96
86
97
87
{% hint style="danger" %}
98
88
You SHALL NOT refer resource, which is created later using conditional operations!
99
89
{% endhint %}
100
90
101
91
### Multiple resources with the same id
102
92
103
-
If you have multiple entries with the same resource id, aidbox will execute them one by one and thus you are able to create a resource with a history in within a single transaction:
93
+
If you have multiple entries with the same resource id, Aidbox will execute them one by one and thus you can create a resource with a history within a single transaction:
@@ -153,10 +152,10 @@ By default Aidbox uses `SERIALIZABLE` transaction isolation level. This may lead
153
152
154
153
See more about [transaction isolation in Postgres documentation](https://www.postgresql.org/docs/current/transaction-iso.html).
155
154
156
-
The best way to handle rejected transactions is to retry them. If it is not possible, you can set maximum isolation level with HTTP header or [environment variable](../reference/configuration/environment-variables/optional-environment-variables.md#box\_features\_fhir\_transaction\_max\_\_isolation\_level). If both HTTP header and environment variable are provided, header will be used.
155
+
The best way to handle rejected transactions is to retry them. If it is not possible, you can set the maximum isolation level with the HTTP header or [environment variable](../reference/configuration/environment-variables/optional-environment-variables.md#box\_features\_fhir\_transaction\_max\_\_isolation\_level). If both the HTTP header and environment variable are provided, the header will be used.
157
156
158
157
{% hint style="danger" %}
159
-
Using isolation level lower than serializable may lead to data serialization anomalies.
158
+
Using an isolation level lower than serializable may lead to data serialization anomalies.
0 commit comments