Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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

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.

 Example

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

 Example

Request:

GET https://<my-dam>/digizuitecore/legacyservice/api/admin/tree-nodes/1
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
    }
  }
}

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

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.

 Example

Request

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

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

Method: PUT

Auth required: YES

Request parameters:

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.

 Example

Request

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

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

Method: PUT

Auth required: YES

Request parameters:

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.

 Example

Request

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

{
  "label": "Updated english doc translation",
  "languageId": 3,
  "treeNodeId": 60,
  "treeValueId": 61
}

Delete a tree node

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

Method: DELETE

Auth required: YES

Request parameters:

Name

Type

Description

treeNodeId

int

The id of the tree node you want to delete.

 Example

Request

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

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

 Example

Request:

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

Response:

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

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

  • No labels