Queries the information about consumer groups within the current account.

Note

This operation is used to query a resource list rather than the details of resources.

QPS limit

The queries per second (QPS) limit on this operation is 10 per user. When the number of calls of this operation per second exceeds the QPS limit, throttling is triggered. If throttling is triggered, your business may be affected. We recommend that you take note of the QPS limit on this operation. For more information, see QPS limit.

Authorization information

Alibaba Cloud accounts and RAM users can call this operation without authorization. However, when a RAM user calls this operation, only the data about the resources that the user has permissions to publish and subscribe to is returned. To obtain data about other resources, the RAM user must be granted permissions on the resources by the Alibaba Cloud account. For more information, see Policies and examples.

Request parameters

Parameter Type Required Example Description
Action String Yes OnsGroupList

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

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance to which the queried groups belong.

GroupId String No GID_test_group_id

This parameter is required only when you query the information about specific groups by using fuzzy search. If this parameter is not configured, the information about all groups is queried.

If you set this parameter to GID_ABC, the information about the groups whose IDs contain GID_ABC is returned. For example, the information about the groups GID_test_GID_ABC_123 and GID_ABC_356 is returned.

GroupType String No tcp

The protocol over which the queried groups publish or subscribe to messages. All clients in the same group communicate with brokers over the same protocol. A group cannot contain both TCP clients and HTTP clients. You must create different groups for TCP clients and HTTP clients. Valid values:

  • tcp: specifies that the group publishes or subscribes to messages over TCP. This value is the default value.
  • http: specifies that the group publishes or subscribes to messages over HTTP.
Tag.N.Key String Yes CartService

The key of the tag that is attached to the group. This parameter is not required. However, if you configure this parameter, you must also configure the Tag.N.Value parameter. If you configure both the Tag.N.Key and Tag.N.Value parameters, the group IDs are filtered based on the specified tag. If you do not configure these parameters, all group IDs are queried.

  • Valid values of N: 1 to 20.
  • The parameter value cannot be an empty string.
  • The value can be up to 128 characters in length. It cannot start with aliyun or acs: or contain http:// or https://.
Tag.N.Value String Yes ServiceA

The value of the tag that is attached to the group. This parameter is not required. However, if you configure this parameter, you must also configure the Tag.N.Key parameter. If you configure both the Tag.N.Key and Tag.N.Value parameters, the group IDs are filtered based on the specified tag. If you do not configure these parameters, all group IDs are queried.

  • Valid values of N: 1 to 20.
  • The parameter value can be an empty string.
  • The value can be up to 128 characters in length. It cannot start with aliyun or acs: or contain http:// or https://.

Response parameters

Parameter Type Example Description
RequestId String 16996623-AC4A-43AF-9248-FD9D2D75****

The ID of the request. This is a common parameter. Each request has a unique ID. This facilitates troubleshooting and fault locating.

Data Array of SubscribeInfoDo

The returned list of subscriptions.

SubscribeInfoDo
Owner String 138015630679****

The Alibaba Cloud account ID of the user who created the messages that the group subscribes to.

UpdateTime Long 1570700979000

The time when the group ID was updated.

IndependentNaming Boolean true

Indicates whether a namespace is configured for the Message Queue for Apache RocketMQ instance. Valid values:

  • true: A separate namespace is configured for the instance. Resource names must be unique within the instance. However, resources in different instances can have the same name.
  • false: No separate namespace is configured for the instance. The resource names must be unique across all instances.
GroupId String GID_test_group_id

The ID of the consumer group.

Remark String test

The remarks of the returned groups.

CreateTime Long 1568896605000

The time when the group was created.

Tags Array of Tag

The tags that are attached to the group.

Tag
Key String CartService

The key of the tag.

Value String ServiceA

The value of the tag.

InstanceId String MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance.

GroupType String tcp

The protocol over which the queried groups publish or subscribe to messages. All clients in the same group communicate with brokers over the same protocol. A group cannot contain both TCP clients and HTTP clients. You must create different groups for TCP clients and HTTP clients. Valid values:

  • tcp: indicates that the group publishes or subscribes to messages over TCP.
  • http: indicates that the group publishes or subscribes to messages over HTTP.

Examples

Sample requests

http(s)://ons.cn-hangzhou.aliyuncs.com/?Action=OnsGroupList
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&Tag.1.Key=CartService
&Tag.1.Value=ServiceA
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<OnsGroupListResponse>
<RequestId>16996623-AC4A-43AF-9248-FD9D2D75****</RequestId>
<Data>
    <SubscribeInfoDo>
        <Owner>138015630679****</Owner>
        <GroupType>tcp</GroupType>
        <InstanceId>MQ_INST_111111111111_DOxxxxxx</InstanceId>
        <CreateTime>1568896605000</CreateTime>
        <UpdateTime>1570700979000</UpdateTime>
        <IndependentNaming>true</IndependentNaming>
        <GroupId>GID_test_group_id</GroupId>
        <Remark>test</Remark>
        <Tags>
            <Tag>
                <Value>ServiceA</Value>
                <Key>CartService</Key>
            </Tag>
        </Tags>
    </SubscribeInfoDo>
</Data>
</OnsGroupListResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "16996623-AC4A-43AF-9248-FD9D2D75****",
  "Data" : {
    "SubscribeInfoDo" : [ {
      "Owner" : "138015630679****",
      "GroupType" : "tcp",
      "InstanceId" : "MQ_INST_111111111111_DOxxxxxx",
      "CreateTime" : 1568896605000,
      "UpdateTime" : 1570700979000,
      "IndependentNaming" : true,
      "GroupId" : "GID_test_group_id",
      "Remark" : "test",
      "Tags" : {
        "Tag" : [ {
          "Value" : "ServiceA",
          "Key" : "CartService"
        } ]
      }
    } ]
  }
}

Error codes

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