Create Asset Tree and Associate Asset¶
Create an asset tree and link an existing asset as the root node of the asset tree. The asset to be linked can be a device asset or a logical asset.
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=associate
Request Parameters (URI)¶
Note
Use one of the following methods to identify the asset to be linked.
Include the
assetIdin the requestInclude both
productKeyanddeviceKeyin the request
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>> |
assetId |
Query |
Optional (See Note above) |
String |
The asset ID. How to get assetId>> |
productKey |
Query |
Optional (See Note above) |
String |
The product key. To be used with |
deviceKey |
Query |
Optional (See Note above) |
String |
The device key. To be used with |
Request Parameters (Body)¶
Name |
Required/Optional |
Data Type |
Description |
|---|---|---|---|
tree |
Optional |
TreeCreateVo Struct |
The details of the asset tree to be created. For more information, see TreeCreateVo Struct. |
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=associate&orgId=yourOrgId&assetId=yourAssetId
method: POST
requestBody:
{
"tree":{
"name":{
"defaultValue":"Name"
}
}
}
Return Sample¶
{
"code": 0,
"msg": "OK",
"requestId": "01b5477a-374e-49a0-8b68-7dbfe8f0b74f",
"data": "theAssetTreeId"
}