Skip to content

Write a batch of rows

POST
/datasets/{datasetId}/rows:batch
curl --request POST \
--url https://api.modeldesk.io/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rows:batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "written": [ { "rowId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "values": { "additionalProperty": [ "example" ] }, "refs": { "additionalProperty": [ { "datasetId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "rowId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } ] }, "platformRefs": { "additionalProperty": [ { "kind": "MODEL", "resourceId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "elementId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } ] }, "parts": { "additionalProperty": [ { "partId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "values": { "additionalProperty": [ "example" ] }, "refs": { "additionalProperty": [ { "datasetId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "rowId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } ] }, "platformRefs": { "additionalProperty": [ { "kind": "MODEL", "resourceId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "elementId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } ] }, "parts": { "additionalProperty": [] } } ] } } ], "removed": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "message": "example", "requestId": "example" }'

Writes and removals as one direct commit on the dataset’s default branch, and answers with the branch as it stands afterwards. A batch changes at most 5000 rows, and a dataset holds at most 100000; either breach is a 400. A batch that carries a requestId this dataset has already committed is a retry: it is answered with the branch rather than applied a second time.

datasetId
required
string format: uuid
Media typeapplication/json

One direct commit’s worth of row changes. Writes and removals travel together because they are one commit. A row id both written and removed is a 400.

object
written

The rows to write, each whole — a row is replaced by what the batch carries.

Array<object>

One entry of a dataset. Both maps are keyed by the data schema’s source element ids, never by a name: the element id is what survives a rename, and it is what lets a model mapping induce a dataset migration later.

object
rowId
required

The row’s stable identity, minted once and surviving every edit.

string format: uuid
values

Value-property source element id to the terms the row holds for it.

object
key
additional properties
Array
refs

Reference-property source element id to the rows it points at.

object
key
additional properties
Array<object>

A pointer to a row, in this dataset or in one this dataset declares a dependency on.

object
datasetId
required
string format: uuid
rowId
required
string format: uuid
platformRefs

Reference-property source element id to the models, model elements and datasets it points at, for a property whose target type is represented by things the platform holds. Such a property holds these and never row references. Absent when the row holds none. A write that leaves platformRefs out keeps the ones the row holds, as a client that knows nothing of them writes every row; one that sends {} clears them. The two fields are told apart each on its own.

object
key
additional properties
Array<object>

A pointer to a thing the platform holds: a model, an element of a model, or a dataset. A model or element is read at the state the dataset pins the model at; a dataset as it stands.

object
kind
required
string
Allowed values: MODEL ELEMENT DATASET
resourceId
required

The model, for a model or an element; the dataset, for a dataset.

string format: uuid
elementId

The element of the model; present exactly for an ELEMENT.

string format: uuid
parts

Containment-property source element id to the parts the row holds inside itself, for a property whose target type has no identity of its own (a contact point, a period). Such a property holds parts and never row references. Absent when the row holds none. A write that leaves parts out keeps the parts the row holds, as a client that knows nothing of parts writes every row; one that sends it, empty included, leaves the row holding what it sent.

object
key
additional properties
Array<object>

One part a row holds inside itself: an occurrence of a containment property whose target type has no identity of its own. Its maps are keyed as a row’s are, and it holds parts of its own to whatever depth the model nests them.

object
partId

The part’s identity inside its row, so a change to one part is told from a change to another. Send it back unchanged on every write of the row; a part written without one gets a new one, and two parts of one row under one id are a 400.

string format: uuid
values

Value-property source element id to the terms the part holds for it.

object
key
additional properties
Array
refs

Reference-property source element id to the rows it points at.

object
key
additional properties
Array<object>

A pointer to a row, in this dataset or in one this dataset declares a dependency on.

object
datasetId
required
string format: uuid
rowId
required
string format: uuid
platformRefs

Reference-property source element id to the models, model elements and datasets the part points at, for a property whose target type is represented by things the platform holds. A part is written whole, so a part sent without them holds none. Absent when the part holds none.

object
key
additional properties
Array<object>

A pointer to a thing the platform holds: a model, an element of a model, or a dataset. A model or element is read at the state the dataset pins the model at; a dataset as it stands.

object
kind
required
string
Allowed values: MODEL ELEMENT DATASET
resourceId
required

The model, for a model or an element; the dataset, for a dataset.

string format: uuid
elementId

The element of the model; present exactly for an ELEMENT.

string format: uuid
parts

Containment-property source element id to the parts this part holds.

object
key
additional properties
Array<object> recursive
removed

The rows to drop.

Array<string>
message
required

What the commit records about the change.

string
requestId

The caller’s id for this write, reused by every retry of it, so a retry after a timeout is recognised rather than applied again.

string

OK

Media typeapplication/json

What a row batch did: where the branch stands now, and whether this call is what put it there.

object
branchId
required
string format: uuid
commitId
required
string format: uuid
message
string
requestId
string
applied
required

False when the batch was recognised as a retry of one already committed, so this call wrote nothing.

boolean
flagged

Row id to what is wrong with it, for the written rows that do not conform. They were written all the same; the clean ones are left out.

object
key
additional properties

How a row stands against its dataset’s data schema. A row that does not conform is flagged and kept, never dropped: reference data arrives incomplete and is corrected in place.

object
valid

Whether no violation is an error. A row whose violations are all warnings is valid and still carries them.

boolean
violations

Absent when nothing is wrong with the row.

Array<object>

One way in which a row does not conform.

object
code
required
string
Allowed values: TOO_FEW_VALUES TOO_MANY_VALUES VALUE_NOT_IN_TYPE PROPERTY_NOT_DECLARED REFERENCE_TARGET_MISSING REFERENCE_DATASET_NOT_DECLARED REFERENCE_MODEL_NOT_DECLARED REFERENCE_TARGET_WRONG_TYPE REFERENCE_TARGET_NOT_SELECTABLE OTHER
propertyId

The schema property’s source element id — the same key the row’s own maps use, so a caller marks the offending cell without a lookup. Absent for a violation about the row itself. For a violation inside a part, the row’s column that holds the part, with path leading from there to the field.

string format: uuid
valueIndex

Which value of the property; absent when the violation is the property’s as a whole. For a violation inside a part, which value of the field path ends at.

integer
path

For a violation inside a part, the way from propertyId down to the field, outermost part first: contactpunt[2].email is one step, the part at index 1 and its property email. Absent for a violation of one of the row’s own fields.

Array<object>

One step of a violation’s way into a part: the part at a position among the parts of the property reached so far, and the property of that part the way goes on to.

object
index
required

The part’s position among that property’s parts, from 0.

integer
partId
required
string format: uuid
propertyId

The part’s property the way goes on to; absent where the violation is about the part.

string format: uuid
message
required
string
severity

How much the violation weighs; the row is kept and flagged either way. A value outside a code list is a WARNING unless the list is marked strict; everything else is an ERROR.

string
Allowed values: WARNING ERROR
inPlatformRefs

For a reference property, which of its lists the violation is about: true for its references to models, model elements and datasets (platformRefs), which valueIndex then counts in; false for its references to rows (refs) where that needs saying beside the other. Absent for its references to rows, as every violation from before the other list existed reads. Inside a part as at the row: beside path, it says which list of the field path ends at.

boolean

Example

{
"flagged": {
"additionalProperty": {
"violations": [
{
"code": "TOO_FEW_VALUES",
"severity": "WARNING"
}
]
}
}
}

The batch is over a limit, says two things about one row, would take the dataset past the row cap, references a dataset the dataset does not declare, points into a model it does not pin, or points at a dataset of another owner or one the caller cannot read

Media typeapplication/problem+json

An RFC 9457 problem document, always sent as application/problem+json.

object
type

Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.

string
violations

Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.

Array<object>
object
property
required
string
message
required
string

Example generated

{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"violations": [
{
"property": "example",
"message": "example"
}
]
}

Not authorized to write this dataset

Media typeapplication/problem+json

An RFC 9457 problem document, always sent as application/problem+json.

object
type

Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.

string
violations

Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.

Array<object>
object
property
required
string
message
required
string

Example generated

{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"violations": [
{
"property": "example",
"message": "example"
}
]
}

Dataset not found

Media typeapplication/problem+json

An RFC 9457 problem document, always sent as application/problem+json.

object
type

Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.

string
violations

Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.

Array<object>
object
property
required
string
message
required
string

Example generated

{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"violations": [
{
"property": "example",
"message": "example"
}
]
}

A row holds parts, or points at models, model elements or datasets, which this environment does not write yet

Media typeapplication/problem+json

An RFC 9457 problem document, always sent as application/problem+json.

object
type

Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.

string
violations

Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.

Array<object>
object
property
required
string
message
required
string

Example generated

{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"violations": [
{
"property": "example",
"message": "example"
}
]
}

Error

Media typeapplication/problem+json

An RFC 9457 problem document, always sent as application/problem+json.

object
type

Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.

string
violations

Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.

Array<object>
object
property
required
string
message
required
string

Example generated

{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"violations": [
{
"property": "example",
"message": "example"
}
]
}