You can call this operation to query device groups by tags.

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set the value to QueryDeviceGroupByTags.
Tags List Yes The list of tags. A tag consists of a TagKey and a TagValue. For more information about tags, see the table Tag.
  • You can enter both TagKey and TagValue.
  • You can enter TagKey only.
CurrentPage Integer No The page of returned results to be displayed. Default value: 1.
PageSize Integer No The number of device groups displayed per page. Default value: 10.
Common request parameters - Yes See Common parameters.
Table 1. Tag
Parameter Type Required Description
TagKey String Yes The key of a tag.
TagValue String No The value of a tag.

Response parameters

Name Type Description
RequestId String The GUID generated by Alibaba Cloud for the request.
Success Boolean Indicates whether the call is successful. A value of true indicates that the call is successful. A value of false indicates that the call has failed.
ErrorMessage String The error message returned when the call fails.
Code String The error code returned when the call fails. For more information about error codes, see Error codes.
PageCount Integer The total number of pages.
PageSize Integer The number of device groups displayed per page.
Page Integer The current page number.
Total Integer The total number of device groups.
Data Data The device groups returned when the call is successful. For more information, see the table DeviceGroup.
Table 2. DeviceGroup
Parameter Type Description
GroupName String The name of a device group.
GroupID String The ID of a device group.

Examples

Request example

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

Response example

JSON format

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

XML format

<? xml version="1.0" encoding="utf-8"? >

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