All Products
Document Center


Last Updated: Jul 23, 2019


This interface is used to send a message to the specified message queue. A common message can be consumed by the consumer immediately after being sent to a message queue. The producer can set the DelaySeconds parameter when sending the message to consume later(the typical scenario is a scheduled task). The initial status of a message with the DelaySeconds value(>0) is Delayed. The message cannot be consumed till its status turns to Active after its DelaySeconds time expires in this status.


The priority of the DelaySeconds parameter specified upon message sending is higher than the DelaySeconds attribute of the delayed message queue. That means, when the values of the two DelaySeconds attributes are different, the value of the DelaySeconds parameter specified upon message sending takes precedence.


A request mainly includes the following parts:

  • Request line

    POST /queues/$queueName/messages HTTP/1.1

  • Special Request Header

    None. See Public Request Headers.

  • Request Body

    Request Body is in XML format. XML contains the attributes for creating message.

Parameter Name Description Parameter Value
MessageBody Required. Message body UTF-8 character set
DelaySeconds Optional. A delay time after which a message can be consumed, measured in seconds An integer between 0 and 604800 (7 days). The default value is 0
Priority Optional. Priority of a specified message.A message with a higher priority is more likely to be consumed earlier The value ranges from 1 to 16 (the value 1 indicates the highest priority). The default value is 8


The returned message includes 3 parts: returned status line, HTTP header and message body.

  • HTTP Status Code

    HTTP/1.1 201 Created

  • Special Response Header

    None. See Public Returned Headers.

  • Response Body

    The returned result is in XML format. The MessageId and MessageBodyMD5 sub-elements of the message are returned.

Parameter Name Description
MessageId Message ID, which is unique in one queue.
MessageBodyMD5 MD5 value of the message body

Special error

Error Code Error Message Status Code
QueueNotExist The queue name you provided is not exist. 404
MalformedXML The XML you provided was not well-formed. 400
InvalidArgument The value of Element should between Low and High seconds/bytes. 400

Request example:

  1. POST /queues/$queueName/messages HTTP/1.1
  2. Host: $
  3. Date: Wed, 18 Mar 2012 12:00:00 GMT
  4. Content-Length:500
  5. Content-Type:text/xml;charset=utf-8
  6. x-mns-version: 2015-06-06
  7. Authorization: MNS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE
  8. <?xml version="1.0” encoding=”UTF-8” ?>
  9. <Message xmlns=””>
  10. <MessageBody>Base64 Encoded Result</MessageBody>
  11. <DelaySeconds>60</DelaySeconds>
  12. <Priority>1</Priority>
  13. </Message>

Response example:

  1. HTTP/1.1 201Created
  2. Connnection:close
  3. Content-Length:120
  4. Content-Type:text/xml;charset=utf-8
  5. x-mns-request-id:512B2A634403E52B1956133E
  6. x-mns-version: 2015-06-06
  7. <?xml version="1.0” encoding=”UTF-8” ?>
  8. <Message xmlns=””>
  9. <MessageId>
  10. 5F290C926D472878-2-14D9529A8FA-200000001
  11. </MessageId>
  12. <MessageBodyMD5>
  13. C5DD56A39F5F7BB8B3337C6D11B6D8C7
  14. </MessageBodyMD5>
  15. </Message>