DC 6.0 [Deprecated] Creating tree values

 

Using BatchUpdateService is deprecated and will be removed in 6.0. Use DC 6.0 Working with tree node definitions instead.

 

 

 

BatchUpdate may be used for more than just setting metadata on assets. It may also be used for creating tree values

URL : /BatchUpdateService.js

Method : POST

Auth required : Yes

Required parameters

Name

Example

Description

Name

Example

Description

accessKey

eb774621-1c2f-467b-b006-a8efa67094a7

accessKey that grants access to the API

The updateXML and values is send as forms data and it looks like this:

updateXML

<r> <metatree_definition fieldId="MetaDataUpdate0"> <item_metafield_labelid fieldId="item_metafield_labelid"/> <prevref fieldId="prevref"/> <sortindex fieldId="sortindex"/> <treevalue fieldId="treevalue"/> <optionvalue fieldId="optionvalue"/> <showcheck fieldId="showcheck"/> <ispublic fieldId="ispublic"/> <visible fieldId="visible"/> </metatree_definition> </r>



values

[{ "Id": "MetaDataUpdate0", "FieldId": "MetaDataUpdate0", "ContainerType": 1, "RowId": 1, "Values": [{ "FieldId": "item_metafield_labelid", "Type": 3, "Values": [51426] }, { "FieldId": "prevref", "Type": 3, "Values": [0] }, { "FieldId": "sortindex", "Type": 3, "Values": [0] }, { "FieldId": "treevalue", "Type": 1, "Values": ["test 2"] }, { "FieldId": "optionvalue", "Type": 1, "Values": ["b9491155-7d9a-43cd-a534-8768aa91a106"] }, { "FieldId": "showcheck", "Type": 2, "Values": [true] }, { "FieldId": "ispublic", "Type": 2, "Values": [true] }, { "FieldId": "visible", "Type": 2, "Values": [true] }], "BaseId": 0 }]

NOTE: The important parts to change in this example is the treevalue which refers to the name of the treevalue, the optionvalue which refers to a unique id for it (it may be the same as the name) and the item_metafield_labelid which refers to the language versioned tree on which the value should be created. Furthermore, prevref is the reference to the parent.

cUrl data example

curl -X POST I am running a few minutes late; my previous meeting is running over.
'/dmm3bwsv3/BatchUpdateService.js?accesskey=eb774621-1c2f-467b-b006-a8efa67094a7' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F 'updateXML=<r><metatree_definition fieldId="MetaDataUpdate0"><item_metafield_labelid fieldId="item_metafield_labelid"/><prevref fieldId="prevref"/><sortindex fieldId="sortindex"/><treevalue fieldId="treevalue"/><optionvalue fieldId="optionvalue"/><showcheck fieldId="showcheck"/><ispublic fieldId="ispublic"/><visible fieldId="visible"/></metatree_definition></r>' \
-F 'values=[{"Id":"MetaDataUpdate0","FieldId":"MetaDataUpdate0","ContainerType":1,"RowId":1,"Values":[{"FieldId":"item_metafield_labelid","Type":3,"Values":[51426]},{"FieldId":"prevref","Type":3,"Values":[0]},{"FieldId":"sortindex","Type":3,"Values":[0]},{"FieldId":"treevalue","Type":1,"Values":["test 2"]},{"FieldId":"optionvalue","Type":1,"Values":["b9491155-7d9a-43cd-a534-8768aa91a106"]},{"FieldId":"showcheck","Type":2,"Values":[true]},{"FieldId":"ispublic","Type":2,"Values":[true]},{"FieldId":"visible","Type":2,"Values":[true]}],"BaseId":0}]'

Success Response

Code : 200 OK

Content example

{ "success": true, "total": 0, "error": "", "items": [{ "Id": "MetaDataUpdate0", "FieldId": "MetaDataUpdate0", "ItemId": 10600, "BaseId": 51637, "TestFase": false, "VersionId": null, "ChangesetId": 0, "Warnings": [] }], "warnings": [] }

Error Response

Code : 200 OK

Content  example