Queries the information about topics that can be accessed by the current account.
Usage notes
This operation returns the basic information about topics and does not return the details of topics.
Request limit
Each Alibaba Cloud account can call this operation up to 10 times per second. If the number of requests that you send to call this operation within one second reaches the request limit of this operation, new requests fail. This may interrupt your business. For information about the request limit of each operation, see API rate limits.
Authorization
By default, only Alibaba Cloud accounts can call this operation. A Resource Access Management (RAM) user can call this operation only after the RAM user is granted the required permissions. The following table describes the permissions that must be granted to a RAM user to call this operation.
API |
Action |
Resource |
---|---|---|
OnsTopicList |
mq:QueryInstanceBaseInfo |
acs:mq:*:*:{instanceId} |
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | OnsTopicList |
The operation that you want to perform. Set the value to OnsTopicList. |
Topic | String | No | test |
The name of the topic that you want to query. This parameter is required when you want to query a specific topic. If you do not include this parameter in the request, all topics that you can access are queried. |
InstanceId | String | Yes | MQ_INST_188077086902****_BXSuW61e |
The ID of the Message Queue for Apache RocketMQ instance that contains the topics you want to query. |
Tag.N.Key | String | Yes | CartService |
The key of a tag that is attached to the topics you want to query. This parameter is not required. If you configure this parameter, you must also configure the Tag.N.Value parameter. If you include the Tag.N.Key and Tag.N.Value parameters in a request, this operation queries only the topics that use the specified tags. If you do not include these parameters in a request, this operation queries all topics that you can access.
|
Tag.N.Value | String | Yes | ServiceA |
The value of a tag that is attached to the topics you want to query. This parameter is not required. If you configure this parameter, you must also configure the Tag.N.Key parameter. If you include the Tag.N.Key and Tag.N.Value parameters in a request, this operation queries only the topics that use the specified tags. If you do not include these parameters in a request, this operation queries all topics that you can access.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 4A978869-7681-4529-B470-107E1379**** |
The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID. |
Data | Array of PublishInfoDo |
The list of topics. |
|
PublishInfoDo | |||
MessageType | Integer | 0 |
The message type. Valid values:
|
RelationName | String | Publish and subscribe |
The name of the relationship between the current account and the topic. The value of this parameter indicates that the current account is the owner of the topic, the current account can publish messages to the topic, the current account can subscribe to the topic, or the current account can publish messages to and subscribe to the topic. |
Owner | String | 138015630679**** |
The user ID of the topic owner. |
IndependentNaming | Boolean | true |
Indicates whether the Message Queue for Apache RocketMQ instance that contains the topic uses a namespace. Valid values:
|
Remark | String | Test |
The description of the topic. |
Relation | Integer | 6 |
Indicates the relationship between the current account and the topic. Valid values:
|
CreateTime | Long | 1570700947000 |
The point in time when the topic was created. |
Topic | String | test |
The name of the topic. |
Tags | Array of Tag |
The tags that are attached to the topic. |
|
Tag | |||
Key | String | CartService |
The key of the tag. |
Value | String | SrviceA |
The value of the tag. |
InstanceId | String | MQ_INST_188077086902****_BXSuW61e |
The ID of the Message Queue for Apache RocketMQ instance that contains the topic. |
ServiceStatus | Integer | 0 |
The status of the topic. Valid values:
|
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
HTTP/1.1 200 OK
Content-Type:application/xml
<OnsTopicListResponse>
<RequestId>4A978869-7681-4529-B470-107E1379****</RequestId>
<Data>
<MessageType>0</MessageType>
<RelationName>Publish and subscribe</RelationName>
<Owner>138015630679****</Owner>
<IndependentNaming>true</IndependentNaming>
<Remark>Test</Remark>
<Relation>6</Relation>
<CreateTime>1570700947000</CreateTime>
<Topic>test</Topic>
<Tags>
<Key>CartService</Key>
<Value>SrviceA</Value>
</Tags>
<InstanceId>MQ_INST_188077086902****_BXSuW61e</InstanceId>
<ServiceStatus>0</ServiceStatus>
</Data>
</OnsTopicListResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "4A978869-7681-4529-B470-107E1379****",
"Data" : [ {
"MessageType" : 0,
"RelationName": "Publish and subscribe",
"Owner" : "138015630679****",
"IndependentNaming" : true,
"Remark": "Test",
"Relation" : 6,
"CreateTime" : 1570700947000,
"Topic" : "test",
"Tags" : [ {
"Key" : "CartService",
"Value" : "SrviceA"
} ],
"InstanceId" : "MQ_INST_188077086902****_BXSuW61e",
"ServiceStatus" : 0
} ]
}
Error codes
For a list of error codes, visit the API Error Center.