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: content/docs/api/data-api.mdx
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -226,9 +226,9 @@ Execute a batch operation (create / update / upsert / delete) on multiple record
226
226
}
227
227
```
228
228
229
-
**Response**: `BatchUpdateResponse` with `succeeded`, `failed`, `total`, and a per-record `results` array. Each entry in `results` has `id`, `success`, an optional `errors` array, and optional `data` (the full record, present when `returnRecords` is `true`).
229
+
**Response**: `BatchUpdateResponse` with `succeeded`, `failed`, `total`, and a per-record `results` array. Each entry in `results` has `id`, `success`, `index` (the row's position in the request array), an optional `errors` array (`ApiError[]` — read `errors[0].message`, branch on `errors[0].code`), and optional `data` (the full record, present when `returnRecords` is `true`).
230
230
231
-
`options.atomic` defaults to `false` (sequential best-effort, stopping at the first failure). Set it to `true` and the whole batch runs inside one transaction: the first failure rolls back every prior write, and the response reports `succeeded: 0`with each row marked `ROLLED_BACK:`, the causal error, or `NOT_ATTEMPTED:`. A deployment whose driver cannot roll back rejects an atomic request with `501 NOT_IMPLEMENTED` instead of running it best-effort — probe `capabilities.transactionalBatch` on `/discovery` first. `atomic` takes precedence over `continueOnError`.
231
+
`options.atomic` defaults to `false` (sequential best-effort, stopping at the first failure). Set it to `true` and the whole batch runs inside one transaction: the first failure rolls back every prior write, and the response reports `succeeded: 0`— each row's `errors[0].code` says what happened: `ROLLED_BACK` (written, then undone), the causal row's own error code, or `NOT_ATTEMPTED` (never reached). A deployment whose driver cannot roll back rejects an atomic request with `501 NOT_IMPLEMENTED` instead of running it best-effort — probe `capabilities.transactionalBatch` on `/discovery` first. `atomic` takes precedence over `continueOnError`.
232
232
233
233
### `POST /data/:object/createMany`
234
234
@@ -273,9 +273,13 @@ deleted one at a time by primary key, so each honours `deleteBehavior`
273
273
at the first failure; `continueOnError: true` processes the remaining ids and
274
274
reports the failures instead.
275
275
276
-
Note that on this route `atomic` only stops the run — deletes already performed
277
-
are **not** rolled back. Unlike `/batch`, `deleteMany` has no wrapping
278
-
transaction yet.
276
+
`options.atomic: true` is honoured here the same way as on `/batch` (#4620): the
277
+
whole id list runs inside one transaction, the first failure rolls back every
278
+
prior delete, and the response reports `succeeded: 0` with each row's
279
+
`errors[0].code` set to `ROLLED_BACK`, the causal error code, or
280
+
`NOT_ATTEMPTED`. A runtime that cannot roll back refuses the request with
281
+
`501 NOT_IMPLEMENTED` rather than degrading to best-effort. The same applies to
Copy file name to clipboardExpand all lines: content/docs/api/wire-format.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -475,7 +475,7 @@ Process many records of a **single** operation type in one request. The body car
475
475
476
476
By default (`options.atomic` omitted or `false`) processing stops at the first failing record, and records written earlier in the same batch are **not** rolled back — there is no wrapping transaction. Add `options.continueOnError: true` to keep going instead and collect a full partial-success report.
477
477
478
-
Send `options.atomic: true` to run the whole batch inside one database transaction: the first failure rolls back every prior write, and the response reports zero successes with each row marked `ROLLED_BACK:`, the causal error, or `NOT_ATTEMPTED:`. A deployment whose driver cannot roll back **rejects** an atomic request with `501 NOT_IMPLEMENTED` rather than quietly running it best-effort — probe `capabilities.transactionalBatch` on `/discovery` to know in advance. `atomic` takes precedence over `continueOnError`.
478
+
Send `options.atomic: true` to run the whole batch inside one database transaction: the first failure rolls back every prior write, and the response reports zero successes — each row's `errors[0].code` says what happened: `ROLLED_BACK` (written, then undone), the causal row's own error code, or `NOT_ATTEMPTED` (never reached). A deployment whose driver cannot roll back **rejects** an atomic request with `501 NOT_IMPLEMENTED` rather than quietly running it best-effort — probe `capabilities.transactionalBatch` on `/discovery` to know in advance. `atomic` takes precedence over `continueOnError`.
479
479
480
480
### Request
481
481
@@ -495,7 +495,7 @@ Send `options.atomic: true` to run the whole batch inside one database transacti
495
495
496
496
### Response — `200 OK`
497
497
498
-
The response is the `BatchUpdateResponse` envelope: a top-level `success` flag plus `total` / `succeeded` / `failed` counts and a per-record `results` array. Each successful entry echoes the written `record`; pass `options.returnRecords: false` to get back just `{ id, success }` per result.
498
+
The response is the `BatchUpdateResponse` envelope: a top-level `success` flag plus `total` / `succeeded` / `failed` counts and a per-record `results` array — each entry is a `BatchOperationResult` (`id`, `success`, `index`, optional `errors`, optional `data`). `index` is the row's position in the request `records` array. Each successful entry echoes the written record on `data`; pass `options.returnRecords: false` to get back just `{ id, success, index }` per result.
499
499
500
500
```json
501
501
{
@@ -505,15 +505,15 @@ The response is the `BatchUpdateResponse` envelope: a top-level `success` flag p
When the batch is not atomic and some records fail, the failing entries carry a single `error`message string (not an array). An atomic batch never returns this shape — it either commits everything or reports every row as failed:
516
+
When the batch is not atomic and some records fail, each failing entry carries an `errors` array of `ApiError` objects — read the human-readable cause from `errors[0].message` and branch on the machine-readable `errors[0].code`. An atomic batch never returns this shape — it either commits everything or reports every row as failed (with `errors[0].code``ROLLED_BACK` / the causal code / `NOT_ATTEMPTED`):
517
517
518
518
```json
519
519
{
@@ -523,8 +523,8 @@ When the batch is not atomic and some records fail, the failing entries carry a
0 commit comments