All Products
Document Center


Last Updated: Jul 23, 2019


This interface is used by the consumer to consume a message in a message queue. The ReceiveMessage operation will change the acquired message to Inactive status. The Inactive duration is determined by the VisibilityTimeout attribute of the queue (for details, see “CreateQueue Interface”).

After the message is successfully consumed, the DeleteMessage interface should be called to delete the message in the VisibilityTimeout period. Otherwise, the message will be reset to Active status and consumable.


A request mainly includes the following parts:

  • Request line

    GET /queues/$queueName/messages?waitseconds=10 HTTP/1.1

  • Special URI Parameter

Parameter Name Description Required?
waitseconds Maximum polling waiting time① of the ReceiveMessage request, measured in seconds Optional


If the ReceiveMessage request carries the waitseconds parameter, the polling waiting time of the ReceiveMessage request is specified by waitseconds. If the waitseconds parameter is not specified, the polling waiting time is specified by the PollingWaitSeconds attribute of the queue (see “CreateQueue Interface”).

  • Special Request Header

    None. See Public Request Headers.

  • Request Body



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

  • HTTP Status Code

    HTTP/1.1 200 OK

  • Special Response Header

    None. See Public Returned Headers.

  • Response Body

    The returned result is in XML format. The message body and attributes of the message are returned.

Parameter Name Description
MessageId Message ID, which is unique in one queue
ReceiptHandle Temporary handle generated for the acquired message, which is used to delete or modify the message in Inactive status and is valid before NextVisibleTime.
MessageBody Message body
MessageBodyMD5 MD5 value of the message body
EnqueueTime Time when a message is sent to the queue, represented in milliseconds that have elapsed since 1970-1-1 0:00
NextVisibleTime Time when a message can be consumed again, represented in milliseconds that have elapsed since 1970-1-1 0:00
FirstDequeueTime Time when a message is consumed for the first time, represented in milliseconds that have elapsed since 1970-1-1 0:00
DequeueCount Total consumption times of a message
Priority Priority of a message

Special Error

Error Code Error Message Status Code
QueueNotExist The queue name you provided is not exist. 404
MessageNotExist Message not exist. 404

Request example:

  1. GET /queues/$queueName/messages HTTP/1.1
  2. Host: $
  3. Date: Wed, 28 May 2012 22:32:00 GMT
  4. x-mns-version: 2015-06-06
  5. Authorization: MNS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE

Response example:

  1. HTTP/1.1 200 OK
  2. Connection:close
  3. Content-Type=text/xml;charset=utf-8
  4. Content-Length:500
  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>5F290C926D472878-2-14D9529A8FA-200000001</MessageId>
  10. <ReceiptHandle>1-ODU4OTkzNDU5My0xNDMyNzI3ODI3LTItOA==</ReceiptHandle>
  11. <MessageBodyMD5>C5DD56A39F5F7BB8B3337C6D11B6D8C7</MessageBodyMD5>
  12. <MessageBody>This is a test message</MessageBody>
  13. <EnqueueTime>1250700979248</EnqueueTime>
  14. <NextVisibleTime>1250700799348</NextVisibleTime>
  15. <FirstDequeueTime>1250700779318</FirstDequeueTime >
  16. <DequeueCount>1</DequeueCount >
  17. <Priority>8</Priority>
  18. </Message>