Create Asset Tree¶
Create an asset tree and a logical asset, and link the asset to the root node of the asset tree.
Operation Permissions¶
Ensure that you have the permission to invoke this API. For more information, see Getting API Calling Permissions.
Request Format¶
POST https://{apigw-address}/asset-tree-service/v2.1/asset-trees?action=create
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Required/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Required |
String |
The OU ID which the Asset belongs to. How to get orgId>> |
Request Parameters (Body)¶
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
asset |
Required |
Asset Struct |
The required data when creating a root node asset. For more information, see Asset Struct. |
tree |
Optional |
TreeCreateVo Struct |
The details of the asset tree to be created. For more information, see TreeCreateVo Struct. |
Asset Struct ¶
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
modelID |
Required |
String |
The model ID of the asset. How to get modelID>> |
name |
Required |
StringI18n |
Specify the asset’s name in its respective locale’s language. For more information, see Internationalized name struct. |
timezone |
Required |
String |
For more information, see Timezone representation. |
description |
Optional |
String |
The asset description. |
attributes |
Optional |
Map |
Attributes of the model which the asset belongs to. For more information, see attributes representation. |
tags |
Optional |
Map |
User-defined tags. For more information, see How to use tag>>. |
TreeCreateVo Struct ¶
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
name |
Required |
StringI18n |
Specify the asset tree’s name in its respective locale’s language. For more information, see Internationalized name struct. |
tags |
Optional |
Map |
User-defined tags. The Key and Value are of String type. How to use tags>> |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
String |
The created asset tree ID. |
Error Codes¶
Code |
Message |
Description |
---|---|---|
17772 |
The quota of tree reaches ceiling |
Number of trees already reaches maximum of the OU. |
99400 |
Invalid arguments |
The request parameter is invalid. Check the request parameters. |
99500 |
System error |
Internal server error. Contact the system administrator. |
Samples¶
Request Sample¶
url: https://{apigw-address}/asset-tree-service/v2.1/asset-trees?action=create&orgId=yourOrgId
method: POST
requestBody:
{
"asset":{
"modelId":"yourModelId",
"name":{
"defaultValue":"Name"
},
"timezone":"+12:00",
"description":"Example of description"
},
"tree":{
"name":{
"defaultValue":"Name"
}
}
}
Return Sample¶
{
"msg": "OK",
"code": 0,
"data": "yourAssetTreeId",
"requestId": "bb4f8c40-604a-451e-83bd-99cfba6bd53e"
}
SDK Samples¶
You can access the SDK samples for Asset Tree Service on GitHub: