Get Asset Tree

Get the details of an asset tree using an asset tree ID.


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


GET https://{apigw-address}/asset-tree-service/v2.1/asset-trees?action=get

Request Parameters (URI)


Name

Location (Path/Query)

Required/Optional

Data Type

Description

orgId

Query

Required

String

The OU ID which the asset belongs to. How to obtain orgId>>

treeId

Query

Required

String

The asset tree ID. How to obtain treeID>>

Response Parameters


Name

Data Type

Description

treeId

String

The asset tree ID.

name

StringI18n

The asset tree name. For more information, see Internationalized name struct.

tags

Map (The Key and Value are of String type)

User-defined tags.

asset

Asset Struct

The details of an asset. For more information, see Asset Struct.

Asset Struct


Name

Data Type

Description

assetId

String

The asset ID.

modelId

String

The model ID of this asset.

modelIdPath

String

The path of the model ID.

name

StringI18n

The asset’s name in its respective locale’s language. For more information, see Internationalized name struct.

timezone

String

Timezone where the asset is located.

description

String

The description of the asset.

label

String

The type of asset.

  • 0: Device asset

  • 1: Logical asset

inValid

Boolean

“True” indicates invalid nodes while “false” indicates valid nodes.

attributes

Map (The Key and Value are of String type.)

The attributes of the model which the asset belongs to.

tags

Map (The Key and Value are of String type.)

User-defined tags.

Error Codes


Code

Message

Description

17404

TreeId is not exist

The tree ID does not exist.

99400

Invalid arguments

The request parameter is invalid. Check the request parameters.

99500

System error

Internal server error. Contact the system administrator.

Samples

Request Sample


url: https://{apigw-address}/asset-tree-service/v2.1/asset-trees?action=get&treeId=yourTreeId&orgId=yourOrgId
method: GET

Return Sample


{
 "code": 0,
 "msg": "OK",
 "requestId": "f3c1ffc7-cc8e-4a50-ad40-0fa7b0c3a7ac",
 "data": {
  "treeId": "BRIt3ee3",
  "name":{
            "defaultValue":"ourTreeId",
            "i18nValue":{
                "en_US":"ourTreeID"
            }
        },
  "tags": {
   "user": "zm",
   "user0": "lily"
  },
  "asset": {
   "inValid": false,
   "assetId": "nlw68lR5",
   "modelId": "model_0422",
   "modelIdPath": "/model_0422",
   "name": {
    "defaultValue": "0430343",
    "i18nValue": {
     "en_US": "0430343"
    }
   },
   "timezone": "+08:00",
   "description": null,
   "label": "1",
   "attributes": {},
   "tags": {
    "tree": "0430"
   }
  }
 }
}

SDK Samples


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