Queries all topics within a specified account.

Usage notes

This operation is used to generate a resource list rather than detailed information.

QPS limit

The queries-per-second (QPS) limit on this operation is 10 per user. Throttling is triggered when the number of calls to this operation per second exceeds the QPS limit. Throttling may affect your business. Therefore, call this operation based on your needs. For more information, see QPS limits.

Authorization information

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

Request parameters

Parameter Type Required Example Description
Action String Yes OnsTopicList

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

InstanceId String Yes MQ_INST_188077086902****_BXSuW61e

The ID of the instance where the topics you want to query are located.

Tag.N.Key String Yes CartService

The key of tag N bound to the resource.

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

The value of tag N bound to the resource.

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

The name of the topic that you want to query. This parameter is required when you want to query a specified topic. If this parameter is not specified, all topics are queried.

Response parameters

Parameter Type Example Description
Data Array of PublishInfoDo

The returned list of all created topics.

PublishInfoDo
CreateTime Long 1570700947000

The time when the topic was created.

IndependentNaming Boolean true

Indicates whether a namespace is configured for the instance where the topic is located. Valid values:

  • true: A separate namespace is configured for the instance. Resource names must be unique within the instance but can be the same across different instances.
  • false: No separate namespace is configured for the instance. Resource names must be globally unique within the instance and across different instances.
InstanceId String MQ_INST_188077086902****_BXSuW61e

The ID of the instance where the topic is located.

MessageType Integer 0

The type of messages in the topic. Valid values:

  • 0: normal messages
  • 1: partitionally ordered messages
  • 2: globally ordered messages
  • 4: transactional messages
  • 5: scheduled or delayed messages
Owner String 138015630679****

The ID of the topic owner. Set the value to the Alibaba Cloud account ID.

Relation Integer 6

The number of the relationship between the API caller and the topic. Valid values:

  • 1: The API caller owns the topic.
  • 2: The API caller can publish messages to the topic.
  • 4: The API caller can subscribe to the topic.
  • 6: The API caller can publish messages to and subscribe to the topic.
RelationName String Authorized publishing and subscription

The name of the relationship between the API caller and the topic, such as the owner, publisher, subscriber, and publisher and subscriber.

Remark String Test

The description of the topic.

Tags Array of Tag

The tags bound to the topic.

Tag
Key String CartService

The key of the tag.

Value String SrviceA

The value of the tag.

Topic String test

The name of the topic.

RequestId String 4A978869-7681-4529-B470-107E1379****

The ID of the request, which is a common parameter. Each request has a unique ID to facilitate troubleshooting and fault locating.

Examples

Sample requests

http(s)://ons.cn-zhangjiakou.aliyuncs.com/? Action=OnsTopicList
&InstanceId=MQ_INST_188077086902****_BXSuW61e
&Tag.1.Key=CartService
&Tag.1.Value=ServiceA
&<Common request parameters>

Sample success responses

XML format

<OnsTopicListResponse>
  <RequestId>4A978869-7681-4529-B470-107E1379****</RequestId>
  <Data>
        <PublishInfoDo>
              <Owner>138015630679****</Owner>
              <Relation>6</Relation>
              <InstanceId>MQ_INST_188077086902****_BXSuW61e</InstanceId>
              <CreateTime>1570700947000</CreateTime>
              <RelationName>Authorized publishing and subscription</RelationName>
              <IndependentNaming>true</IndependentNaming>
              <Topic>test</Topic>
              <MessageType>0</MessageType>
              <Remark>Test</Remark>
              <Tags>
                    <Tag>
                          <Value>SrviceA</Value>
                          <Key>CartService</Key>
                    </Tag>
              </Tags>
        </PublishInfoDo>
  </Data>
</OnsTopicListResponse>

JSON format

{
        "RequestId": "4A978869-7681-4529-B470-107E1379****",
        "Data": {
            "PublishInfoDo": {
                "Owner": "138015630679****",
                "Relation": 6,
                "InstanceId": "MQ_INST_188077086902****_BXSuW61e",
                "CreateTime": 1570700947000,
                "RelationName": "Authorized publishing and subscription",
                "IndependentNaming": true,
                "Topic": "test",
                "MessageType": 0,
                "Remark": "Test",
                "Tags": {
                    "Tag": {
                        "Value": "SrviceA",
                        "Key": "CartService"
                    }
                }
            }
        }
    }

Error codes

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