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)

Mandatory/Optional

Data Type

Description

orgId

Query

Mandatory

String

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

treeId

Query

Mandatory

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 details on the structure and locales supported, see Internationalized name struct>>

tags

Map

User-defined tags. (The Key and Value are of String type.)

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 details on the structure and locales supported, 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 attributes of the model which the asset belongs to. Key is the attribute ID, which is of String type. The Value type depends on the attribute defined in the model.

tags

Map

User-defined tags. (The Key and Value are of String type.)

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 EnOS support.

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: