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.

  • treeId: supports “in” and “=”
  • tags: supports “=”, “!=” and “exist”
  • name: supports fuzzy inquiry of specified language
    • name like 'xxx': fuzzy inquiry of default name, Chinese name, English name, Japanese name, and Spanish name
    • name.default like 'xxx': fuzzy inquiry of default name
    • name.zh_CN like 'xxx': fuzzy inquiry of Chinese name, if no Chinese name, fuzzy inquiry of default name
    • name.en_US like 'xxx': fuzzy inquiry of English name, if no English name, fuzzy inquiry of default name
    • name.ja_JP like 'xxx': fuzzy inquiry of Japanese name, if no Japanese name, fuzzy inquiry of default name
    • name.es_ES like 'xxx': fuzzy inquiry of Spanish name, if no Spanish name, fuzzy inquiry of default name

Do not use this with filter.

How to use expression>>

filter Optional Filter Struct

The conditions used for the search. The use of tags are supported. If not specified, results will return all asset trees. Do not use this with expression. For more details, see Filter Struct.

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. sorters is not supported to sort the response. For more details, see Pagination Request 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>>

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

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.


AssetTree Struct
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: