Calls the Subscribe operation to create a subscription for a topic.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
mns:Subscribe |
update |
*Subscription
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| TopicName |
string |
Yes |
The name of the topic. |
topic****1 |
| SubscriptionName |
string |
Yes |
The name of the subscription. |
testSubscription |
| PushType |
string |
Yes |
Push type of the subscriptionValid values:
Note: The following values are deprecated and are only used for compatibility with legacy subscriptions:
|
queue |
| Endpoint |
string |
Yes |
Endpoint address for receiving messagesThe format varies depending on the value of
|
http://*****.com/uri1/xxx |
| NotifyStrategy |
string |
No |
The retry strategy when an error occurs while pushing messages to the endpoint. Valid values:
|
BACKOFF_RETRY |
| NotifyContentFormat |
string |
No |
Format of the pushed message contentValid values:
|
XML |
| MessageTag |
string |
No |
The tag used for message filtering in this subscription. Only messages with a matching tag are pushed. The value is a string of up to 16 characters. By default, no message filtering is applied. |
important |
| DlqPolicy |
object |
No |
The dead-letter queue policy. |
|
| Enabled |
boolean |
No |
Specifies whether to enable dead-letter message delivery. |
true |
| DeadLetterTargetQueue |
string |
No |
The destination queue for dead-letter message delivery. |
deadLetterTargetQueue |
| TenantRateLimitPolicy |
object |
No |
The throttling policy. |
|
| Enabled |
boolean |
No |
Specifies whether to enable the throttling policy. Valid values: true and false. |
|
| MaxReceivesPerSecond |
integer |
No |
The maximum number of pushes or consumptions per second. |
50 |
| StsRoleArn |
string |
No |
The ARN of the RAM role assumed by the service. The format is acs:ram::{Alibaba Cloud account ID}:role/{RoleName}. Replace {Alibaba Cloud account ID} with the Alibaba Cloud account ID that calls the API operation. |
acs:ram::1234567890:role/AliyunMNSNotificationRole |
| DmAttributes |
object |
No |
The email push attributes. This parameter is required when PushType is set to dm. The value is in JSON format and contains the following fields:
|
|
| AccountName |
string |
No |
The sender address. |
notify@example.com |
| Subject |
string |
No |
The email subject. |
notify |
| DysmsAttributes |
object |
No |
The SMS push attributes. This parameter is required when PushType is set to alisms. The value is in JSON format and contains the following fields:
|
|
| TemplateCode |
string |
No |
The SMS template code. |
123456 |
| SignName |
string |
No |
The SMS signature name. |
阿里云短信测试专用 |
| KafkaAttributes |
object |
No |
The Kafka push type is deprecated. |
|
| BusinessMode |
string |
No |
The Kafka push type is deprecated. |
Default empty string |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
06273500-249F-5863-121D-74D51123**** |
| Code |
integer |
The response code. |
200 |
| Status |
string |
The response status. |
Success |
| Message |
string |
The response message. |
operation success |
| Success |
boolean |
Indicates whether the request was successful. |
true |
| Data |
string |
The response data. |
{'Code': 200, 'Success': True} |
Examples
Success response
JSON format
{
"RequestId": "06273500-249F-5863-121D-74D51123****",
"Code": 200,
"Status": "Success",
"Message": "operation success",
"Success": true,
"Data": "{'Code': 200, 'Success': True}"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.