There are generally 3 apis you should 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 available.
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 |
---|---|---|
| int | A language-independent id for this tree node. |
| string | A language-independent string value for this tree node. |
| int/null | The |
| int | A value indicating how this node should be sorted in relation to all other tree nodes. |
| int | The metafield id of the tree metafield this node belongs to. |
| int | The itemId of the tree node. |
| string/guid/uuid | The itemGuid of the tree node. |
| dictionary | The translations of this tree node. The key is the languageId. |
| string | The title/name/label of the tree node in this language. |
| int | The language id of this translation. |
| int | The language specific id of this tree node. |
Get all tree nodes
URL: /digizuitecore/legacyservice/api/admin/tree-nodes
Method: GET
Auth required: YES
This will get all tree nodes defined in the system.
Get a specific tree node
URL: /digizuitecore/legacyservice/api/admin/tree-nodes/{treeNodeId}
Method: GET
Auth required: YES
Create a new tree node
URL: /digizuitecore/legacyservice/api/admin/tree-nodes
Method: POST
Auth required: YES
This api is also available as a bulk variant, that takes an array of the objects described here: /digizuitecore/legacyservice/api/admin/tree-nodes/bulk-create
Request parameters:
Name | Type | Description |
---|---|---|
| string | A language-independent string value for this tree node. |
| int/null | The |
| int | A value indicating how this node should be sorted in relation to all other tree nodes. |
| int | The metafield id of the tree metafield this node belongs to. |
| enum, string, one of:
| Controls how access rights/item security is created when this tree node is created.
If not specified, CalculateAutomatically will be used. |
| array of object | The translations that should be created for this object. |
| int | The id of the language this translation is for. |
| string | The language specific translation of this value. |
Update a tree node
URL: /digizuitecore/legacyservice/api/admin/tree-nodes/{treeNodeId}
Method: PUT
Auth required: YES
Request parameters:
Name | Type | Description |
---|---|---|
| string | A language-independent string value for this tree node. |
| int/null | The |
| int | A value indicating how this node should be sorted in relation to all other tree nodes. |
| int | The id of the tree node you want to update. Should be the same id as was passed in the url. |
Update a tree node translation
URL: /digizuitecore/legacyservice/api/admin/tree-nodes/{treeNodeId}/{languageId}
Method: PUT
Auth required: YES
Request parameters:
Name | Type | Description |
---|---|---|
| int | The language independent id of the tree node to update. |
| int | The id of the language you want to update. |
| string | The new translation the tree node should have in the specified language. |
Delete a tree node
URL: /digizuitecore/legacyservice/api/admin/tree-nodes/{treeNodeId}
Method: DELETE
Auth required: YES
Request parameters:
Name | Type | Description |
---|---|---|
| int | The id of the tree node you want to delete. |
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 the tree nodes you have access to based on item security. You can use the /assignable
variant of the endpoint to get only tree nodes you can actually have access rights to assign to assets.
The tree nodes in the response is sorted such that they can be rendered stright to a screen without doing any additional sorting.
Request parameters:
Name | Type | Description |
---|---|---|
metafieldId | int | The metafield id of the tree metafield to fetch nodes for. |
metafieldItemGuid | string/guid/uuid | The itemGuid of the tree metafield to fetch nodes for. |
Response properties:
Name | Type | Description |
---|---|---|
| int | A language-independent id for this tree node. |
| string | A language-independent string value for this tree node. |
| int/null | The |
| int | A value indicating how this node should be sorted in relation to all other tree nodes. |
| int | The metafield id of the tree metafield this node belongs to. |
| int | The itemId of the tree node. |
| string/guid/uuid | The itemGuid of the tree node. |
| dictionary | The translations of this tree node. The key is the languageId. |
| string | The title/name/label of the tree node in this language. |
| int | The language id of this translation. |
| int | The language specific id of this tree node. |
| int | Indicates how many labels deep this node is. Very useful for rendering the tree nodes in a tree like structure. |
| bool | If this node has any childn nodes. Useful foro |
Create new tree nodes while updating asset metadata
See documentation and examples here: https://digizuite.atlassian.net/wiki/spaces/DD/pages/3519873239/DC+5.8+core+api+Update+metadata#Tree-request-properties