You can call the OnsTopicList API to query the information list of all topics under an account.

This operation is used to generate a resource list without viewing specific information.

Debugging

You can directly run this interface in OpenAPI Explorer, saving you from the trouble of calculating the signature. After the SDK runs successfully, OpenAPI Explorer automatically generates SDK code examples.

Request parameters

Name Type Required or not Sample value Description
Action String Yes OnsTopicList

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

InstanceId String No Mq_inst_1111111111_doxxxxxx

The instance ID corresponding to the Topic information list to be obtained. This parameter is required for instances with independent namespaces.

Topic String No Test

This parameter is set when you query the specified Topic. Otherwise, all topics are queried.

Response Data

Name Type Sample value Description
Data

The list of all published topics.

PublishInfoDo

The list of all published topics.

CreateTime Long 1570700947000

Created at

IndependentNaming Boolean True

Indicates whether the instance of the Topic has a namespace. Valid values:

  • True: Has an independent namespace. The resource name must be unique within the instance and can be repeated across instances.
  • False: There is no separate namespace. The resource name must be globally unique within an instance or across instances.
InstanceId String Mq_inst_1111111111_doxxxxxx

The ID of the instance to which the Topic belongs.

MessageType Integer 0

The message type. Valid values:

  • 0: Normal message
  • 1: Partitionally ordered message
  • 2: Globally ordered message
  • 4: Transactional Message
  • 5: Scheduled/delayed message
Owner String 138015630679 *****

The ID of the Topic owner, which is the Alibaba Cloud UID.

Relation Integer 6

All relation IDs. Valid values:

  • 1Owner
  • 2: Publish
  • 4: Subscription is allowed.
  • 6: Publish and subscribe.
RelationName String Authorized publishing/subscription

All relation names, such as owner, subscribable, publishable, as well as subscribable and publishable

Remark String Test

Remarks

Topic String Test

Topic Name

RequestId String Renewal

A common parameter. Each request is unique.

Example

Request example


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

Normal response example

XMLFormat

<OnsTopicListResponse>
  <Data>
        <PublishInfoDo>
              <Relation>6</Relation>
              <Owner>138015630679****</Owner>
              <RelationName> authorized publishing/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>

JSONFormat

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

Error code

AccessError CenterFor more information, see error codes.