DC 5.8 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

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

Method: GET

Auth required: YES

This will get all tree nodes defined in the system.

Request:

GET https://<my-dam>/digizuitecore/legacyservice/api/admin/tree-nodes Authorization: AccessKey MIIC...dEK

 

Response:

[ { "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}

Method: GET

Auth required: YES

 

Request:

GET https://<my-dam>/digizuitecore/legacyservice/api/admin/tree-nodes/1 Authorization: AccessKey MIIC...dEK

Response

 

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

Name

Type

Description

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.

accessRightsMode

enum, string, one of:

  • CalculateAutomatically

  • DoNothing

Controls how access rights/item security is created when this tree node is created.

  • CalculateAutomatically: Security is inherited from either the parent tree node, or if not available, the metafield.

  • DoNothing: No item security is created for this tree node, which means nobody can access it. If you use this, you should make sure to create item security entries yourself.

If not specified, CalculateAutomatically will be used.

labels

array of object

The translations that should be created for this object.

labels.languageId

int

The id of the language this translation is for.

labels.label

string

The language specific translation of this value.

 

Request

Response

 

Update a tree node

URL: /digizuitecore/legacyservice/api/admin/tree-nodes/{treeNodeId}

Method: PUT

Auth required: YES

Request parameters:

Name

Type

Description

Name

Type

Description

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.

treeNodeId

int

The id of the tree node you want to update. Should be the same id as was passed in the url.

Request

Response

Update a tree node translation

URL: /digizuitecore/legacyservice/api/admin/tree-nodes/{treeNodeId}/{languageId}

Method: PUT

Auth required: YES

Request parameters:

Name

Type

Description

Name

Type

Description

treeNodeId

int

The language independent id of the tree node to update.

languageId

int

The id of the language you want to update.

label

string

The new translation the tree node should have in the specified language.

Request

Response

 

Delete a tree node

URL: /digizuitecore/legacyservice/api/admin/tree-nodes/{treeNodeId}

Method: DELETE

Auth required: YES

Request parameters:

Name

Type

Description

Name

Type

Description

treeNodeId

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

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

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.

depth

int

Indicates how many labels deep this node is. Very useful for rendering the tree nodes in a tree like structure.

hasChildren

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