Query and Sort Asset Sub-Node

Last Updated on : 2023-06-20 15:22:52download

Get the sub-node assets under a specified asset. You can sort them by asset name or creation time.

API address

GET: /v1.1/iot-02/assets/{asset_id}/sub-assets

Request parameter

Parameter nameTypeINRequiredDescription
asset_idStringuritrueThe asset ID.
page_noIntegerquerytrueThe current page number.
page_sizeIntegerquerytrueThe number of entries returned on each page.
sort_ruleStringquerytrueThe supported sorting rules are as follows:
  • assetsNameAsc: Sort by asset name in ascending order.
  • assetsNameDesc: Sort by asset name in descending order.
  • createTimeAsc: Sort by creation time in ascending order.
  • createTimeDesc: Sort by creation time in descending order.

Return parameter

Parameter nameTypeDescription
resultAssetsPageListResponseThe returned result about assets.

Description of result

Parameter nameTypeDescription
listListThe list of asset results.
has_nextBooleanSpecifies whether there is a next page.

Description of list

Parameter nameTypeDescription
asset_idStringThe asset ID.
parent_asset_idStringThe ID of the parent asset. The top-level ID is set to -1.
asset_nameStringThe name of a specified asset.
asset_full_nameStringThe full name of a specified asset.
levelIntegerThe hierarchical level of a specified asset. The root node is set to 0.

Request example

GET: /v1.1/iot-02/assets/abcd/sub-assets?page_no=1&page_size=20&sort_rule=assetNameAsc

Return example

{
    "list": [
        {
            "level": 0,
            "asset_id": "123",
            "asset_full_name": "123",
            "asset_name": "123",
            "parent_asset_id": "-1"
        }
    ],
    "has_next": false
}

Error code

For more information, see error code.