About
View the full schema here.
The Batch API lets you combine create, update and delete operations on both components and references belonging to disparate workspaces into a single request. All operations are executed within a transaction. If any of the operations fail then the whole request will fail leaving the state of Ardoq unmodified.
Batch Ids
A Batch Id (batchId
) is an optional unique identifier that can be associated with the components and references being created. The type of a Batch Id should be a string. The batch Id serves the following purposes:
-
Allow for a component being created to be referenced within the same request.
- A component may use the
batchId
of another component in the request as the value for theparent
field. - A reference may use the
batchId
of a component in the request as the value for thesource
field. - A reference may use the
batchId
of a component in the request as the value for thetarget
field.
- A component may use the
-
In the response every provided batch Id will be associated with a generated OID. As the response of a batch does not guarantee any ordering, the
batchId
can be stored on the client side and then used to find the associated created component/reference in the response.
Example
Let us imagine that we have two components C1
, C2
and a single reference R1
between them. In other words, C1
is the source of R1
and C2
is the target of R1
.
Type | Name | oid |
---|---|---|
component | C1 | c253c98231776d0c8a54879e |
component | C2 | d893c982317afd0c8a54875f |
Type | Name | oid | source | target |
---|---|---|---|---|
reference | R1 | 91ab09087115f76e365134c5 | c253c98231776d0c8a54879e | d893c982317afd0c8a54875f |
We want to create a new component C3
and set it as the target
of the reference R1
. We want to update the name of the component C1
to have the name C1_updated
and we should delete the existing target component C2
. After the update we want the state to look like this:
Type | Name | oid |
---|---|---|
component | C1_updated | c253c98231776d0c8a54879e |
component | C3 | <new oid> |
Type | Name | oid | source | target |
---|---|---|---|---|
reference | R1 | 91ab09087115f76e365134c5 | c253c98231776d0c8a54879e | <new oid> |
{
"components": {
"create": [
{
"batchId": "my_C3_component",
"body": {
"rootWorkspace": "c253c98231776d0c8a54879e",
"typeId": "p1024822409134",
"name": "C3"
}
}
],
"update": [
{
"id": "c253c98231776d0c8a54879e",
"ifVersionMatch": "latest",
"body": {
"name": "C1_updated"
}
}
],
"delete": [
{
"id": "d893c982317afd0c8a54875f"
}
]
},
"references": {
"update": [
{
"id": "c253c98231776d0c8a54879e",
"ifVersionMatch": "latest",
"body": {
"target": "my_C3_component"
}
}
]
}
}