You can call this operation to query all topics under your account.

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

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 OnsTopicList

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

InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance corresponding to the topics you want to query.

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

The returned list of all published topics.

PublishInfoDo
CreateTime Long 1570700947000

The time when the topic was created.

IndependentNaming Boolean true

Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance corresponding to the topic. Valid values:

  • true: An independent namespace is configured for the Message Queue for Apache RocketMQ instance. Resource names must be unique within the Message Queue for Apache RocketMQ instance but can be the same across different Message Queue for Apache RocketMQ instances.
  • false: No independent namespace is configured for the Message Queue for Apache RocketMQ instance. Resource names must be globally unique across all Message Queue for Apache RocketMQ instances.
InstanceId String MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance corresponding to the topic.

MessageType Integer 0

The type of messages in the topic. Valid values:

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

The ID of the topic owner. The value is an Alibaba Cloud account ID.

Relation Integer 6

The ID 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 the topic.
  • 4: The API caller can subscribe to the topic.
  • 6: The API caller can publish and subscribe to the topic.
RelationName String Authorized publishing and subscription

The name of the relationship between the API caller and the topic, for example, owner, publisher, subscriber, and publisher and subscriber.

Remark String test

The description of the topic.

Topic String test

The name of the topic.

RequestId String 4A978869-7681-4529-B470-107E1379FBF2

The ID of the request. This is a common parameter.

Examples

Sample requests

http(s)://[Endpoint]/? Action=OnsTopicList
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&<Common request parameters>

Sample success responses

XML format

<OnsTopicListResponse>
  <Data>
        <PublishInfoDo>
              <Relation>6</Relation>
              <Owner>138015630679****</Owner>
              <RelationName>Authorized publishing and subscription</RelationName>
              <IndependentNaming>true</IndependentNaming>
              <InstanceId>MQ_INST_111111111111_DOxxxxxx</InstanceId>
              <CreateTime>1570700947000</CreateTime>
              <Topic>test</Topic>
              <Remark>test</Remark>
              <MessageType>0</MessageType>
        </PublishInfoDo>
  </Data>
  <RequestId>4A978869-7681-4529-B470-107E1379FBF2</RequestId>
</OnsTopicListResponse>

JSON format

{
	"Data": {
		"PublishInfoDo": [
			{
				"Relation": 6,
				"Owner": "138015630679****",
				"RelationName": "Authorized publishing and subscription",
				"IndependentNaming": true,
				"InstanceId": "MQ_INST_111111111111_DOxxxxxx",
				"CreateTime": 1570700947000,
				"Topic": "test",
				"Remark": "test",
				"MessageType": 0
			}
		]
	},
	"RequestId": "4A978869-7681-4529-B470-107E1379FBF2"
}

Error codes

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