Queries device groups by tag.

Limits

Each Alibaba Cloud account can run a maximum of 5 queries per second (QPS).

Note RAM users of an Alibaba Cloud account share the quota of the account.

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes QueryDeviceGroupByTags

The operation that you want to perform. Set the value to QueryDeviceGroupByTags.

Tag.N.TagKey String Yes group

The key of each tag.

Tag.N.TagValue String Yes tag

The value of the tag.

IotInstanceId String No iot_instc_pu****_c*-v64********

The ID of the instance. You can view the instance ID on the Overview page in the IoT Platform console.

Notice
  • If your instance has an ID, you must configure this parameter. If you do not set this parameter, the call fails.
  • If your instance has no Overview page or ID, you do not need to set this parameter.

For more information, see Overview.

CurrentPage Integer No 1

The number of the page to return. Default value: 1.

PageSize Integer No 10

The number of entries to return on each page. Default value: 10.

In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this operation. For more information, see Common request parameters.

Response parameters

Parameter Type Example Description
Code String iot.system.SystemException

The error code returned if the call fails. For more information, see Error codes.

Data Array of DeviceGroup

The group information returned if the call succeeds.

DeviceGroup
GroupId String Z0ElGF5aqc0t****

The ID of the group.

GroupName String test11

The name of the group.

ErrorMessage String A system exception occurred.

The error message returned if the call fails.

Page Integer 1

The number of the returned page.

PageCount Integer 1

The total number of pages.

PageSize Integer 10

The number of entries returned on each page.

RequestId String 9599EE98-1642-4FCD-BFC4-039E458A4693

The ID of the request.

Success Boolean true

Indicates whether the call was successful.

  • true: The call was successful.
  • false: The call failed.
Total Integer 1

The total number of records.

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=QueryDeviceGroupByTags
&Tag.1.TagKey=group
&Tag.1.TagValue=tag
&CurrentPage=1
&PageSize=10
&<Common request parameters>

Sample success responses

XML format

<QueryDeviceGroupByTagsResponse> 
    <PageCount>1</PageCount>  
    <Data> 
        <DeviceGroup> 
            <GroupName>test11</GroupName>  
            <GroupId>Z0ElGF5aqc0t****</GroupId> 
        </DeviceGroup> 
    </Data>  
    <Page>1</Page>  
    <PageSize>10</PageSize>  
    <RequestId>9599EE98-1642-4FCD-BFC4-039E458A4693</RequestId>  
    <Success>true</Success>  
    <Total>1</Total> 
</QueryDeviceGroupByTagsResponse>

JSON format

{
    "PageCount": 1, 
    "Data": {
        "DeviceGroup": [
            {
                "GroupName": "test11", 
                "GroupId": "Z0ElGF5aqc0t****"
            }
        ]
    }, 
    "Page": 1, 
    "PageSize": 10, 
    "RequestId": "9599EE98-1642-4FCD-BFC4-039E458A4693", 
    "Success": true, 
    "Total": 1
}

Error codes

For a list of error codes, visit the API Error Center.