Model tree
List, create, rename, move, and delete the folders and models of the process model tree.
The process models of a tenant are organized in a tree of folders and models, the same tree BPMS 3.x shows in its process designer. Every node has an id, a name, and isFolder; every new folder or model goes inside an existing folder. The operations below work on the tree of your tenant only, and require the BPMS 3.x authorities of the designer.
| Operation | Call | Authority |
|---|---|---|
| List the tree | GET /api/v1/model/nodes | 2.1 (Model), 2.2.2.1, or 2.2.2.2 |
| Create a folder or a model | POST /api/v1/model/nodes | 2.1.3 (Save) or 2.1.4 (Save As) |
| Rename a node | PATCH /api/v1/model/nodes/{id} | 2.1.3 or 2.1.4 |
| Move a node to another folder | PUT /api/v1/model/nodes/{id}/parent | 2.1 |
| Delete a node and its contents | DELETE /api/v1/model/nodes/{id} | 2.1.3 or 2.1.4 |
List the tree
curl -sS -H "Authorization: Bearer $TOKEN" "$BPMS_URL/api/v1/model/nodes"The answer holds every folder and model of the tenant, the root folders first:
{
"items": [
{"id": 1, "name": "Processes", "isFolder": true},
{"id": 2, "name": "Purchasing", "isFolder": false, "parent": {"id": 1, "name": "Processes", "isFolder": true}}
]
}parent is absent on a root folder.
Create a folder or a model
curl -sS -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
"$BPMS_URL/api/v1/model/nodes" -d '{"parentId": 1, "name": "Purchasing", "isFolder": false}'parentId must be a folder of your tenant. With isFolder set to false it creates an empty model. It answers 201 with the new node and its address in the Location header.
Rename a node
curl -sS -X PATCH -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
"$BPMS_URL/api/v1/model/nodes/2" -d '{"name": "Purchase orders"}'It answers 200 with the renamed node. Nothing else changes.
Move a node
curl -sS -X PUT -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
"$BPMS_URL/api/v1/model/nodes/2/parent" -d '{"parentId": 3}'It moves the node, with everything inside it, into another folder, and answers 200 with the node. Moving it to the folder it is already in changes nothing. A root folder cannot be moved.
Delete a node
curl -sS -X DELETE -H "Authorization: Bearer $TOKEN" "$BPMS_URL/api/v1/model/nodes/2"It deletes the node and everything inside it, as BPMS 3.x does, and answers 204. A deletion cannot be undone. A root folder, or a node whose contents are still in use, for example by a deployed process, is not deleted.
Rules and errors
Names are required, cannot be blank, and have at most 255 characters. Every change is recorded in the audit log in the same transaction. Creations, moves, and deletions in the same tenant's tree take turns, so two of them at the same time cannot leave the tree inconsistent.
| Status | code | When |
|---|---|---|
400 | core.validation-failed | A field is missing or invalid; errors names each field. |
401 | core.authentication-required | The call has no valid token. |
403 | core.authority-required | The caller lacks the authority the operation requires. |
404 | model.node-not-found | The node does not exist in your tenant or is deleted. |
409 | model.parent-not-folder | The parent is a model, not a folder. |
409 | model.move-into-descendant | The node would move into itself or into one of its own folders. |
409 | model.root-not-changeable | A root folder cannot be moved or deleted. |
409 | model.node-in-use | Something still uses the node or its contents, such as a deployment. |
409 | model.node-shared | The node's contents include a node of another tenant. |
In the OpenAPI document, the operations are listModelNodes, createModelNode, updateModelNode, moveModelNode, and deleteModelNode, under the model tag.