Queries device groups by tag.

Limits

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

Note Resource Access Management (RAM) users of an Alibaba Cloud account share the quota of the account.

Debugging

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 instance ID. This parameter is not required for public instances. However, the parameter is required for the instances that you have purchased.

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 API 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 page number of the returned page.

PageCount Integer 1

The total number of pages returned.

PageSize Integer 10

The number of entries returned per page.

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

The ID of the request.

Success Boolean true

Indicates whether the call succeeds.

  • true: The call succeeded.
  • false: The call failed.
Total Integer 1

The total number of entries returned.

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.