Publishes a message to a specified topic. After the message is published to the topic, MNS pushes the message to the specified endpoints.

Request header

This operation uses only common request headers. For more information, see Common parameters.

Request syntax

POST /topics/$TopicName/messages HTTP/1.1

Request parameters

Parameter Type Required Description
MessageBody String Yes The content of the message.
MessageTag String No The tag of the message.
MessageAttributes Object Yes The endpoint to which messages are pushed.
Valid values:
  • HTTP: HTTP gateway
  • Queue: MNS queue

Response parameters

Parameter Type Example Description
MessageId String D273CD6A89564E54-1-15180395A19-20000**** The ID of the message. The message ID is unique in the topic.
MessageBodyMD5 String 3AC6DD36D2D6B7283F2F490A0975**** The MD5 hash of the message body.


Sample success responses

HTTP/1.1 201 Created

<?xml version="1.0" encoding="utf-8"?>
<Message xmlns="">

Error codes

Error code Error message HTTP status code
TopicNotExist The topic you provided does not exist. 404