Query Asset Hierarchy


Get asset hierarchies by object instance IDs.

Request Format


GET https://{api-gateway}/cds-asset-service/v1.0/hierarchy?action=query

Request Parameters


Name Location Mandatory/Optional Data Type Description
orgId Query Mandatory String The organization ID which the asset belongs to. How to get orgId >>
mdmIds Query/Form Mandatory String The object instance ID of the asset. Separate multiple IDs by commas. Up to 20000 object instances are allowed in a single query. To ensure query performance, it is recommended that you pass in no more than 100 object instances in a single query.
mdmTypes Query/Form Optional String The object type ID which the asset belongs to. Separate multiple IDs by commas. Up to 100 object type IDs are allowed in a single query. All child hierarchies will be returned if mdmTypes is not set. How to get mdmTypes>>
attributes Query/Form Optional String The attribute of the asset. Separate multiple attributes by commas. Both model attributes and “virtual attributes” defined in Common Data Service are supported. How to get attributes>>
locale Query/Form Optional String Use zh-CN, en-US, ja-JP, or es-ES. If not specified, the value is set to en_US by default.
withI18n Query/Form Optional Boolean Whether to return the internationalization content. The value is true or false. Default is false.
filter Query/Form Optional String
Specify how to filter the returned data by attributes. For example, [[{"field":"field1","operator":">=","value":"1"},{"field":"field2","operator":"<=","value":"2"}],[{"field":"field3","operator":"==","value":"3"}]], which means the returned data is filtered by (field1 >= 1 and field2 <= 2) or (field3=3).
If you specify the value of the name field, you can specify the value in the internationalized content. For example, [{"field":"name","operator":"==","value":"Solar_CombinerBox"}] and the parameter locale = en_US, which means the objects whose English name is Solar_CombinerBox will be returned.
orderBy Query/Form Optional String
Specify how to sort the returned data by attributes. For example, [{“field”:”field1”,”order”:”ASC”}, {“field”:”field2”,”order”:”DESC”}], which means the returned data is sorted first by field1 in ascending order and then by field2 in descending order.
If you specify the value of the name field, you can specify the value in the internationalized content. For example, [{"field":"name","order":"ASC"}] and the parameter locale = en_US, which means the returned data is sorted by English name.
pageSize Query/Form Optional Integer The number of the returned records on a single page. The maximum number is 20000.
pageNo Query/Form Optional Integer The number of page to be returned, starting from 1.

Response Content Type


application/json; charset = UTF-8

Response Parameters


Name To Return Definitely/Conditionally Data Type Description
data Definitely Asset Struct Describe the asset information. See Query Accessible Asset.
pagination Definitely Pagination Struct Describe the pagination information. See Pagination Struct.

Pagination Struct


Name To Return Definitely/Conditionally Data Type Description
pageNo Definitely Integer The number of page to be returned, starting from 1.
pageSize Definitely Integer The number of the returned records on a single page.
totalSize Definitely Integer The total number of the returned records.

Samples

Request Sample


GET https://{api-gateway}/cds-asset-service/v1.0/hierarchy?action=query&orgId=yourOrgId&mdmIds=yourMdmId&withI18n=true

Response Sample


{
    "data": {
        "yourMdmId": {
            "mdmObjects": {
               "Solar_CombinerBox":[
                    {
                        "mdmId":"yourChildMdmId",
                        "attributes": {
                            "mdmType": "Solar_CombinerBox",
                            "modelId": "EnOS_Solar_CombinerBox",
                            "timezone": "+08:00",
                            "nameI18n": {
                              "defaultVaule": "Solar_CombinerBox",
                              "i18nValue": {
                                "en_US": "Solar_CombinerBox",
                                "zh_CN": "太阳能汇流箱",
                                "de_DE": "Solar_CombinerBox"
                              }
                            },
                            "name": "yourMdmName",
                            "branches": "2,3,4,5,6,7,8,9,10,11,12,13,14,15,16",
                            "topoParentDeviceID": "yourParentDeviceId",
                            "modelIdPath": "/EnOS_Solar_CombinerBox",
                            "mdmId": "yourChildMdmId",
                            "parentId": "yourMdmId",
                            "branchMax": "16"
                        }
                    }
                ],
                "Solar_Site": [
                    {
                        "mdmId": "yourMdmId",
                        "attributes": {
                            "altitude": "4.0",
                            "timezone": "+08:00",
                            "longitude": "121.0846",
                            "mdmId": "yourMdmId"
                        }
                    }
                ]
            }
        }
    },
    "code": 0,
    "msg": "OK",
    "traceId": "1234567890abcdefghijkl0987654321"
}