Search Asset Path¶
Search for paths on the asset tree. A path is a complete path from a superior asset node to a subordinate asset node, which can contain intermediate asset nodes.
If you need to invoke this API after performing bulk updates to relevant asset trees using other APIs, it is recommended to wait for about 2 seconds to avoid obtaining unupdated data.
Request Format¶
POST https://{apigw-address}/asset-tree-service/v2.1/asset-paths?action=search
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Mandatory |
String |
The organization ID which the asset belongs to. How to get orgId>> |
treeId |
Query |
Mandatory |
String |
The asset tree ID. How to get treeID>> |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
pagination |
Optional |
Pagination Request Struct |
Lists the paging requirements in a request. When not specified, 100 records are displayed per page by default. The maximum records per page is 1000 but for optimal performance, it is recommended to have not more than 50 records per page. |
from |
Optional |
From-to Struct |
The starting point of the asset path. If not provided, it is the root node of the asset tree. For more details, see From-to Struct. |
to |
Optional |
From-to Struct |
The ending point of the asset path. If not provided, it is the child node of the asset tree. For more details, see From-to Struct. |
projection |
Optional |
Projection struct |
Enables you to crop the data result set returned in the interface request if needed. Only the specified fields will be returned in the data result set if this parameter is used. Otherwise all fields are returned. For more details, see How does projection crop the result set? |
pathProjection |
Optional |
String |
Accepts only 2 two types of values: “COMPLETE” (default) or “END_NODE_ONLY”.
|
From-to Struct ¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
rootModelIds |
Optional |
String Array |
The model ID of the root node. Provide multiple root model IDs if you want to query multiple root nodes. |
modelIds |
Optional |
String Array |
The model ID. Provide multiple root model IDs if you want to query multiple Models. How to get modelID>> |
assetIds |
Optional |
String Array |
The asset ID. Provide multiple asset IDs if you want to query multiple assets. How to get assetId>> |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
assets |
Map |
The asset data on the path. The Key is of String type, and the Value is of |
assetPaths |
String Array |
If the |
Asset Struct¶
Name |
Data Type |
Description |
---|---|---|
assetId |
String |
The asset ID. |
name |
StringI18n |
The name of the asset in all its respective locale’s language. |
description |
String |
The asset description. |
attributes |
Map |
The attributes of the model which the asset belongs to. The Key is the attribute ID, which is of String type. The Value type depends on the attribute defined in the model. |
timezone |
String |
The timezone where the asset is located. |
modelId |
String |
The model ID. |
modelIdPath |
String |
The model ID path. |
tags |
Tag struct |
User-defined tags. (The Key and Value are of String type.) |
inValid |
Boolean |
Whether the node is valid or not. |
label |
String |
The tag of the asset. |
Sample 1¶
Request Sample¶
url: https://{apigw-address}/asset-tree-service/v2.1/asset-paths?action=search&treeId=yourTreeId&orgId=yourOrgId
method: POST
requestBody:
{
"pagination":{
"pageNo":1,
"pageSize":10
},
"projection":[
"assets.*.attributes",
"assetPaths"
]
}
Return Sample¶
{
"code": 0,
"msg": "OK",
"requestId": "381ffc90-ee96-45a9-bbf4-8f82efed9823",
"data": {
"assets": {
"yourAssetId1": {
"attributes": {
"starsystem": "sss",
"de001": 123
}
},
"yourAssetId2": {
"attributes": {
}
},
"yourAssetId3": {
"attributes": {
}
},
"yourAssetId4": {
"attributes": {
}
}
},
"assetPaths": [
[
"yourAssetId4",
"yourAssetId1",
"yourAssetId3"
],
[
"yourAssetId4",
"yourAssetId2"
]
]
},
"pagination": {
"sortedBy": null,
"pageNo": 1,
"pageSize": 10,
"totalSize": 2
}
}
Sample 2¶
Request Sample¶
url: https://{apigw-address}/asset-tree-service/v2.1/asset-paths?action=search&treeId=yourTreeId&orgId=yourOrgId
method: POST
requestBody:
{
"pagination": {
"pageNo": 1,
"pageSize": 10
},
"from": {
"modelIds": [
"extend_model"
]
},
"to": {
"assetIds": [
"MkblvAJ5"
]
}
}
Return Sample¶
{
"code": 0,
"msg": "OK",
"requestId": "94347fc1-4b3c-447b-b542-03fa68a1a88f",
"data": {
"assetPaths": [
[
"yourAssetId1",
"yourAssetId2"
]
],
"assets": {
"DWJdfX3D": {
"inValid": false,
"assetId": "yourAssetId1",
"modelId": "extend_model",
"modelIdPath": "/copy_model/extend_model",
"name": {
"defaultValue": "hahha",
"i18nValue": {
"en_US": "hahha"
}
},
"timezone": "+09:00",
"description": "eeeeee",
"label": "1",
"attributes": {
"invType": 1,
"capacity": 5.0
},
"tags": {
}
},
"MkblvAJ5": {
"inValid": false,
"assetId": "yourAssetId2",
"modelId": "planet",
"modelIdPath": "/planet",
"name": {
"defaultValue": "lkkkkk",
"i18nValue": {
"en_US": "lkkkkk"
}
},
"timezone": "+08:00",
"description": "huyyyyy",
"label": "1",
"attributes": {
"starsystem": "yyyy",
"de001": 123
},
"tags": {
}
}
}
},
"pagination": {
"pageNo": 1,
"pageSize": 10,
"totalSize": 1
}
}
SDK Samples¶
You can access the SDK samples for Asset Tree Service on GitHub: