There are generally 3 apis you should APIs to be aware of when working with tree nodes. Each API covers slightly different use cases. Those use cases are outlined in this document.
CRUD on tree nodes
This is the most general use case, where you don’t care about the tree nodes for specific cases and want to manage which tree nodes are availablean integration is managing the tree node definitions.
This requires the Editor_SystemTools_Metadata
role.
There are 6 endpoints to be aware of here. These should feel natural if you have worked with REST before.
Response properties
Name | Type | Description |
---|
treeNodeId
| int | A language-independent id for this tree node. |
optionValue
| string | A language-independent string value for this tree node. |
parentId
| int/null | The treeNodeId of the parent node of this node. Or null if the node doesn’t have a parent. |
sortIndex
| int | A value indicating how this node should be sorted in relation to all other tree nodes. |
metaFieldId
| int | The metafield id of the tree metafield this node belongs to. |
itemId
| int | The itemId of the tree node. |
itemGuid
| string/guid/uuid | The itemGuid of the tree node. |
labels
| dictionary | The translations of this tree node. The key is the languageId. |
labels.label
| string | The title/name/label of the tree node in this language. |
labels.languageId
| int | The language id of this translation. |
labels.treeValueId
| int | The language specific id of this tree node. |
Get all tree nodes
URL: /digizuitecore/legacyservice/api/admin/tree-nodes
...
Expand |
---|
|
Request: Code Block |
---|
GET https://<my-dam>/digizuitecore/legacyservice/api/admin/tree-nodes
Authorization: AccessKey MIIC...dEK |
Response: Code Block |
---|
| [
{
"treeNodeId": 1,
"optionValue": "c44ab339-d8ba-490c-a0fc-ff73708d9b49",
"parentId": null,
"sortIndex": 0,
"metaFieldId": 50390,
"itemId": 9561,
"itemGuid": "011996e9-6b80-40a7-8cdf-c2ba26858978",
"labels": {
"3": {
"label": "Digizuite™ Media Manager",
"languageId": 3,
"treeValueId": 1
},
"1": {
"label": "Digizuite™ Media Manager",
"languageId": 1,
"treeValueId": 32
}
}
}
// Many more nodes omitted
] |
|
Get a specific tree node
URL: /digizuitecore/legacyservice/api/admin/tree-nodes/{treeNodeId}
...
Expand |
---|
|
Request: Code Block |
---|
GET https://<my-dam>/digizuitecore/legacyservice/api/admin/tree-nodes/1
Authorization: AccessKey MIIC...dEK |
Response Code Block |
---|
{
"treeNodeId": 1,
"optionValue": "c44ab339-d8ba-490c-a0fc-ff73708d9b49",
"parentId": null,
"sortIndex": 0,
"metaFieldId": 50390,
"itemId": 9561,
"itemGuid": "011996e9-6b80-40a7-8cdf-c2ba26858978",
"labels": {
"3": {
"label": "Digizuite™ Media Manager",
"languageId": 3,
"treeValueId": 1
},
"1": {
"label": "Digizuite™ Media Manager",
"languageId": 1,
"treeValueId": 32
}
}
} |
|
Create a new tree node
URL: /digizuitecore/legacyservice/api/admin/tree-nodes
...
Expand |
---|
|
Request Code Block |
---|
POST https://<my-dam>/digizuitecore/legacyservice/api/admin/tree-nodes
Authorization: AccessKey MIIC...dEK
Content-Type: application/json
{
"optionValue": "doc-value",
"parentId": null,
"sortIndex": 0,
"metaFieldId": 50188,
"labels": [
{
"languageId": 3,
"label": "a value for the documentation"
},
{
"languageId": 1,
"label": "En værdi til dokumentationen"
}
],
"accessRightsMode": "CalculateAutomatically"
} |
Response Code Block |
---|
{
"treeNodeId": 60,
"optionValue": "doc-value",
"parentId": null,
"sortIndex": 0,
"metaFieldId": 50188,
"itemId": 20476,
"itemGuid": "14f4e3ba-6112-40df-a02d-3b272c45915d",
"labels": {
"1": {
"label": "En værdi til dokumentationen",
"languageId": 1,
"treeValueId": 60
},
"3": {
"label": "a value for the documentation",
"languageId": 3,
"treeValueId": 61
}
}
} |
|
Update a tree node
URL: /digizuitecore/legacyservice/api/admin/tree-nodes/{treeNodeId}
...
Expand |
---|
|
Request Code Block |
---|
PUT https://<my-dam>/digizuitecore/legacyservice/api/admin/tree-nodes/60
Authorization: AccessKey MIIC...dEK
Content-Type: application/json
{
"optionValue": "updated-doc-value",
"parentId": null,
"sortIndex": 0,
"treeNodeId": 60
} |
Response Code Block |
---|
| {
"treeNodeId": 60,
"optionValue": "updated-doc-value",
"parentId": null,
"sortIndex": 0,
"metaFieldId": 50188,
"itemId": 20476,
"itemGuid": "14f4e3ba-6112-40df-a02d-3b272c45915d",
"labels": {
"1": {
"label": "En værdi til dokumentationen",
"languageId": 1,
"treeValueId": 60
},
"3": {
"label": "a value for the documentation",
"languageId": 3,
"treeValueId": 61
}
}
} |
|
Update a tree node translation
URL: /digizuitecore/legacyservice/api/admin/tree-nodes/{treeNodeId}/{languageId}
...
Expand |
---|
|
Request Code Block |
---|
PUT https://<my-dam>/digizuitecore/legacyservice/api/admin/tree-nodes/60/3
Authorization: AccessKey MIIC...dEK
Content-Type: application/json
{
"label": "Updated english doc translation"
}
|
Response Code Block |
---|
| {
"label": "Updated english doc translation",
"languageId": 3,
"treeNodeId": 60,
"treeValueId": 61
} |
|
Delete a tree node
URL: /digizuitecore/legacyservice/api/admin/tree-nodes/{treeNodeId}
...
Expand |
---|
|
Request Code Block |
---|
DELETE https://<my-dam>/digizuitecore/legacyservice/api/admin/tree-nodes/60
Authorization: AccessKey MIIC...dEK |
Response <Empty response> |
Get tree nodes for tree to display
URL:
/digizuitecore/legacyservice/api/tree/nodes/metafield/{metafieldId}
/digizuitecore/legacyservice/api/tree/nodes/metafield/{metafieldId}/assignable
/digizuitecore/legacyservice/api/tree/nodes/metafield/{metafieldItemGuid}
/digizuitecore/legacyservice/api/tree/nodes/metafield/{metafieldItemGuid}/assignable
Method: GET
Auth required: YES
This will get you gets the tree nodes you have which the authorized user has access to based on item security. You can use . It is available in two flavors. One which returns everything the user has read access to and the /assignable
variant of the endpoint to get only tree nodes you can actually have access rights to assign to assetswhich returns everything the user has write access to. The difference between the two is what the user can assign to an asset and what the user can see as assigned on the asset.
The tree nodes in the response is sorted such that they can be rendered stright straight to a screen without doing any additional sorting.
...
Expand |
---|
|
Request: Code Block |
---|
GET https://<my-dam>/digizuitecore/legacyservice/api/tree/nodes/metafield/50188
Authorization: AccessKey MIIC...dEK |
Response: Code Block |
---|
| {
"items": [
{
"depth": 0,
"hasChildren": true,
"treeNodeId": 4,
"optionValue": "5a9fe2a0-e935-490f-9b6c-6fee5bfcc006",
"parentId": null,
"sortIndex": 0,
"metaFieldId": 50188,
"itemId": 9608,
"itemGuid": "fbee1405-7939-41fb-ace8-6aba17eefec4",
"labels": {
"1": {
"label": "Folder A",
"languageId": 1,
"treeValueId": 4
},
"3": {
"label": "Folder A",
"languageId": 3,
"treeValueId": 6
}
}
},
{
"depth": 1,
"hasChildren": true,
"treeNodeId": 20,
"optionValue": "e91016a1-f558-4b15-9f19-ad03a79323f3",
"parentId": 4,
"sortIndex": 0,
"metaFieldId": 50188,
"itemId": 9624,
"itemGuid": "1755afb3-210f-48ff-b2e1-133e2ad2b124",
"labels": {
"1": {
"label": "Folder AA",
"languageId": 1,
"treeValueId": 20
},
"3": {
"label": "Folder AA",
"languageId": 3,
"treeValueId": 22
}
}
}
],
"errorCode": 0,
"errorMessage": "",
"hasError": false
} |
|
See documentation and examples here: https://digizuite.atlassian.net/wiki/spaces/DD/pages/3519873239/DC+5.8+core+api+Update+metadata#Tree-request-properties
...