Search Asset Node


Search for assets based on the search criteria.

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-nodes?action=searchAsset

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.

  • assetId, modelId, rootModelId and treeId: support “in” and “=”
  • assetIds, modelIds and rootModelIds: support “in”
  • productKey, deviceKey and attributes: supports “=” and “like”
  • createTime: supports =, <=, >=
  • tags.*: supports “in” and “exists”, and “like”
  • 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 AssetSearchVo Struct

The conditions used for the search. Do not use this with expression. For more details, see AssetSearchVo 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 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. How does projection crop the result set>>

Note: EnOS Edge does not support this parameter.

AssetSearchVo Struct

Name Mandatory/Optional Data Type Description
assetIds Optional String Array The list of asset IDs.
modelIds Optional String Array The list of model IDs.
rootModelIds Optional String Array The list of root model IDs.
attributes Optional Map (Key is of String type, Value is of Object type) The attributes of the model which the asset belongs to.
tags Optional Map (Key and Value are of String type) The user-defined tags.
nameLike Optional I18nSearchVo Struct The asset name, which supports fuzzy query. For more details, see I18nSearchVo Struct.
treeId Optional String The asset tree ID.

Response Parameters

Name Data Type Description
data Array A list of the assets. Information include assetId, name, and attributes from Asset Struct.

Error Codes

Code Message Description
99400 Invalid arguments The request parameter is invalid. Check the request parameters.
99500 System error Internal server error. Contact EnOS support.

Samples

Request Sample

url: https://{apigw-address}/asset-tree-service/v2.1/asset-nodes?action=searchAsset&orgId=yourOrgId
method: POST
requestBody:
{
"projection": ["attributes", "assetId", "name"]
}

Return Sample

{
    "code": 0,
    "msg": "OK",
    "requestId": "cf08e75c-325a-429f-bdb9-ec5d6a1250d7",
    "pagination": {
       "pageNo": 1,
       "pageSize": 10,
       "totalSzie": 10,
       "sortedBy": null
    },
    "data": [{
       "assetId": "yourAssetId1",
       "name": {
           "i18nValue": {},
           "defaultValue": "earth"
       },
       "attributes": {
           "starsystem": "Solar System",
           "de001": 123
       }
    }, {
       "assetId": "yourAssetId2",
       "name": {
           "i18nValue": {},
           "defaultValue": "earth"
       },
       "attributes": {
           "starsystem": "Solar System",
           "de001": 123
       }
    }, {
       "assetId": "yourAssetId3",
       "name": {
           "i18nValue": {},
           "defaultValue": "earth"
       },
       "attributes": {
           "starsystem": "Solar System",
           "de001": 123
       }
    }, {
       "assetId": "yourAssetId4",
       "name": {
           "i18nValue": {},
           "defaultValue": "venus"
       },
       "attributes": {
           "starsystem": "Solar System",
           "de001": 123
       }
    }, {
       "assetId": "yourAssetId5",
       "name": {
           "i18nValue": {},
           "defaultValue": "1559140566137"
       },
       "attributes": {
           "starsystem": "Solar System",
           "de001": 123
       }
    }, {
       "assetId": "yourAssetId6",
       "name": {
           "i18nValue": {},
           "defaultValue": "earth"
       },
       "attributes": {
           "starsystem": "Solar System",
           "de001": 123
       }
    }, {
       "assetId": "yourAssetId7",
       "name": {
           "i18nValue": {},
           "defaultValue": "earth"
       },
       "attributes": {
           "starsystem": "Solar System",
           "de001": 123
       }
    }]
}

SDK Samples


You can access the SDK samples for Asset Tree Service on GitHub: