Search Asset Tree¶
Search for asset trees based on the query criterion.
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-trees?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>> |
Request Parameters (Body)¶
Note
Use either expression
or filter
to search, but not both together. EnOS Cloud only supports searching by expression
while EnOS Edge supports expression
or filter
.
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
expression |
Optional |
String |
The conditions used for the search. The fields that are supported for query include the below.
Do not use this with |
filter |
Optional |
Filter Struct |
The conditions used for the search. The use of Note: EnOS Cloud does not support this parameter. |
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. |
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>> |
Filter Struct ¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
tags |
Optional |
Map (Key and Value are of String type) |
User-defined tags. How to use tags>> |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Array of AssetTree Structs |
Details of the asset tree based on the assetId. For the definition of an AssetTree Struct, see the table below. |
Name |
Data Type |
Description |
---|---|---|
treeId |
String |
The asset tree ID. |
name |
StringI18n |
The asset tree name. For more details on the structure and locales supported, see Internationalized name struct. |
tags |
Tag struct |
The user-defined tags. |
asset |
Asset Struct |
The details of an asset. For more information, see Asset struct. |
Samples¶
Request Sample¶
url: https://{apigw-address}/asset-tree-service/v2.1/asset-trees?action=search&orgId=yourOrgId
method: POST
requestBody:
{
"expression":"tags.k1 ='v1' ",
"pagination": {
"pageNo": 1,
"pageSize": 10
},
"projection": ["asset"]
}
Return Sample¶
{
"code":0,
"msg":"OK",
"requestId":"82248518-6da4-49d2-8d07-cf7a0ff55b60",
"data":[
{
"treeId":"yourTreeId",
"tags":{
},
"asset":{
"modelId":"yourModelId",
"assetId":"yourAssetId",
"timezone":"+08:00",
"name":{
"i18nValue":{
"en_US":"zmTree604111zzz"
},
"defaultValue":"zmTree604"
},
"description":"",
"attributes":{
},
"inValid":false,
"label":"1",
"modelIdPath":"/NULLMODEL",
"tags":{
}
}
}
]
}
SDK Samples¶
You can access the SDK samples for Asset Tree Service on GitHub: