Write a batch of rows
const url = 'https://api.modeldesk.io/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rows:batch';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"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"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Body
Section titled “Request Body”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
The rows to write, each whole — a row is replaced by what the batch carries.
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
The row’s stable identity, minted once and surviving every edit.
Value-property source element id to the terms the row holds for it.
object
Reference-property source element id to the rows it points at.
object
A pointer to a row, in this dataset or in one this dataset declares a dependency on.
object
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
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
The model, for a model or an element; the dataset, for a dataset.
The element of the model; present exactly for an ELEMENT.
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
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
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.
Value-property source element id to the terms the part holds for it.
object
Reference-property source element id to the rows it points at.
object
A pointer to a row, in this dataset or in one this dataset declares a dependency on.
object
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
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
The model, for a model or an element; the dataset, for a dataset.
The element of the model; present exactly for an ELEMENT.
Containment-property source element id to the parts this part holds.
object
The rows to drop.
What the commit records about the change.
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.
Responses
Section titled “Responses”OK
What a row batch did: where the branch stands now, and whether this call is what put it there.
object
False when the batch was recognised as a retry of one already committed, so this call wrote nothing.
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
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
Whether no violation is an error. A row whose violations are all warnings is valid and still carries them.
Absent when nothing is wrong with the row.
One way in which a row does not conform.
object
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.
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.
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.
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
The part’s position among that property’s parts, from 0.
The part’s property the way goes on to; absent where the violation is about the part.
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.
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.
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
An RFC 9457 problem document, always sent as application/problem+json.
object
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.
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.
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.
object
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
An RFC 9457 problem document, always sent as application/problem+json.
object
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.
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.
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.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}Dataset not found
An RFC 9457 problem document, always sent as application/problem+json.
object
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.
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.
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.
object
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
An RFC 9457 problem document, always sent as application/problem+json.
object
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.
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.
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.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}default
Section titled “default”Error
An RFC 9457 problem document, always sent as application/problem+json.
object
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.
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.
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.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}