Search Site


Get the basic information of sites.

Operation Permissions


Before invoking this API, ensure that the service account has been authorized the policy that includes the following service(s) and action permission(s). For how to authorize the service account, see Managing Service Accounts.

Required Policy

Required Permission

Device Management

Read

Before You Start


The OU has been bounded with an OU template.

Request Format


POST https://{apigw-address}/amc/v1.0/site?action=search

Request Parameters (URI)


Name

Location (Path/Query)

Required/Optional

Data Type

Description

orgId

Query

Required

String

The organization ID which the site belongs to. How to get orgId>>

Request Parameters (Body)


Name

Required/Optional

Data Type

Description

expression

Optional

String

The expressions used for the search. The fields that are supported for search include the below.

  • attributes: Supports “=”, “exists”, “not exists”, and “in”. Use attributes.{attributeId} to specify the attributes for the search. E.g. attributes.temperature = 35.5.

  • name: Supports fuzzy inquiry of the specified language:

    • name like 'xxx': Fuzzy inquiry of default name, Chinese name, and English 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.

  • assetId: Supports “=” and “in”.

siteTypeId

Optional

String

The identifier of the site type. Get the information of all type sites if blank.

pagination

Optional

pagination Request Parameters

Lists the paging requirements in a request. The max records per page is 200. The default records per page is 100. Supports only pageNo and pageSize. The earlier the device was created, the higher the results displayed.

Response Parameters


Name

Data Type

Description

data

Site Struct Array

The information of the site.

Site Struct


Name

Data Type

Description

assetId

String

The asset ID of the site.

name

StringI18n

The name of the site.

modelId

String

The model ID of the site.

timezone

String

The timezone of the site.

description

String

The description of the site.

attributes

Map (Key is of String type, Value is Object)

The attributes of the site.

Key is the attribute ID, Value is the value of the attribute.

tags

Map (Key is of String type, Value is of String type)

The tags of the site.

Key is the key of the tag, Value is the value of the tag.

typeInfo

Metadata Struct

The information of the site type.

Metadata Struct


Name

Data Type

Description

identifier

String

The identifier of the site type.

name

StringI18n

The name of the site.

type

String

The business object category of the site: SITE.

Error Codes


Code

Message

Description

99500

Internal server error

Internal server error. Contact EnOS support.

99400

Invalid pagination parameters

pagination parameters are invalid. Check the request parameters.

99400

Operators {xxx} are not supported. Please use these operators: {yyy}

The operators are not supported. xxx is not supported. Please use yyy.

99400

Expression syntax error

Expression syntax error. Check the expressions.

99400

PageSize value cannot exceed 200

The value of pageSize parameter in pagination can not exceed 200.

Samples

Request Sample

URL: https://{apigw-address}/amc/v1.0/site?action=search&orgId=yourOrgId

method: POST

requestBody:
{
    "pagination":{
        "pageNo":1,
        "pageSize":10
    },
    "expression":"attributes.altitude = 123.000000"
}

Response Sample

{
    "code":0,
    "msg":null,
    "requestId":"f3bf3b13-058a-481d-88c0-06087fd36554",
    "data":[
        {
            "assetId":"HnfxM8Rc",
            "name":{
                "defaultValue":"123",
                "i18nValue":{

                }
            },
            "modelId":"EnOS_Solar_Site",
            "timezone":"+08:00",
            "description":null,
            "attributes":{
                "altitude":123,
                "latitude":123,
                "combinerBoxAmount":1,
                "capacity":123,
                "omtAmount":1,
                "bxtfAmount":1,
                "emtAmount":1,
                "wstAmount":1,
                "acCbxAmount":2,
                "equipmentAmount":1,
                "gmtAmount":1,
                "strInvAmount":0,
                "longitude":123
            },
            "tags":{
                "amc_source":"amc",
                "amc_deviceType":"SolarSite",
                "amc_classType":"Site"
            },
            "typeInfo":{
                "identifier":"SolarSite",
                "name":{
                    "defaultValue":"Solar Site",
                    "i18nValue":{

                    }
                },
                "type":"Site"
            }
        }
    ],
    "pagination":{
        "sortedBy":null,
        "pageNo":1,
        "pageSize":10,
        "totalSize":1
    }
}