DC 5.9 Working with tree node definitions
There are generally 3 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 an integration is managing the tree node definitions.
This requires the Editor_SystemTools_Metadata
role.
There are 6 endpoints to be aware of here.
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 gets the tree nodes which the authorized user has access to based on item security. It is available in two flavors. One which returns everything the user has read access to and the /assignable
variant of the endpoint which 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 straight 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: DC 5.9 Updating asset metadata | Tree request properties