Queries the topics that belong to an Alibaba Cloud account. The topics are displayed by page.
Authorization
By default, only Alibaba Cloud accounts can call this operation. RAM users can call this operation only after these RAM users are granted related permissions. The following table describes the authorization information of this operation. For more information, see Permission policies and examples.
Item | Value |
---|---|
API operation | ListTopic |
Action | mns:ListTopic |
Resource | acs:mns:$region:$accountid:/topics |
Description
To query the topics that contain a specific prefix, you can specify the x-mns-prefix
parameter when you call the ListTopic operation.
x-mns-ret-number
parameter, the NextMarker
parameter that indicates the start position of the next page is returned. When you
send another request to query the remaining topics, you must set the x-mns-marker
parameter to the returned value of the NextMarker parameter.
Request
A request consists of the following parts:
- Request line
GET /topics HTTP/1.1
- Operation-specific request headers
Parameter Type Required Example Description x-mns-marker Integer No 10 The start position of the next page. You can retrieve the value of this parameter from the NextMarker
parameter in the previous response.x-mns-ret-number Integer No 2 The maximum number of results that can be returned for a single request. Valid values: 1 to 1000.
x-mns-prefix String No topic The prefix of the topics to be queried. For more information about other parameters, see Common parameters.
- Request body
None.
Response
A response consists of the following parts:
- HTTP status code
HTTP/1.1 200 OK
- Operation-specific response headers
None.
- Response body
The response body is in the XML format. A list of topics is returned and each topic includes a topic URL. If the number of the returned topics exceeds the value of the
x-mns-ret-number
parameter, the value of theNextMarker
parameter that indicates the start position of the next page is returned.
Examples
Sample requests
GET /topics HTTP/1.1
x-mns-marker: 10
x-mns-ret-number:2
Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
Date: Tue, 08 Dec 2015 05:59:22 GMT
Authorization: NS15B4D3461F177624206A:ytChIeJt2klpvFxGCgVsPNI0****
x-mns-version: 2015-06-06
Sample success responses
HTTP/1.1 200 OK
x-mns-request-id:566671BAB2B71C9C1600****
x-mns-version: 2015-06-06
<?xml version="1.0" encoding="utf-8"?>
<Topics xmlns="http://mns.aliyuncs.com/doc/v1/">
<Topic>
<TopicURL>http://$AccountId.mns.cn-hangzhou.aliyuncs.com/topics/$TopicName1</TopicURL>
</Topic>
<Topic>
<TopicURL>http://$AccountId.mns.cn-hangzhou.aliyuncs.com/topics/$TopicName2</TopicURL>
</Topic>
<NextMarker>OTczNjU4MTcvYmRwejd6NXluby8yNjg0Mi9UZXN0VG9waWMtMy8w</NextMarker>
</Topics>
Error codes
No operation-specific errors occur when you call this operation. Common errors include unauthorized access and invalid parameters. For more information, see Error codes.