Deletes a message that has been consumed. To specify the message to delete, you must provide the receipt handle that was returned when the message was last consumed. The operation can succeed only before the time that is specified by NextVisibleTime. After the time is reached, the status of the message becomes Active and the receipt handle expires. If you use an expired receipt handle to delete the message, the deletion fails. You must consume the message again to obtain a new receipt handle before you can delete the message.

Request

A request consists of the following parts:

  • Request line

    DELETE/$queueName/messages? receiptHandle=<receiptHandle> HTTP/1.1

  • Operation-specific URI parameter
    Parameter Description Required
    ReceiptHandle The receipt handle that was returned when the message was last consumed. For more information, see ReceiveMessage. Yes
  • Operation-specific request headers

    None. For more information about common request parameters, see Common parameters.

  • Request body

    None.

Response

A response consists of a status line, HTTP headers, and a response body.

  • HTTP status code

    HTTP/1.1 204 NoContent

  • Operation-specific response headers

    None. For more information about common response parameters, see Common parameters.

  • Response body

    None.

Error codes

Error code Error message HTTP status code
QueueNotExist The queue name you provided is not exist. 404
InvalidArgument The value of Element should between Low and High seconds/bytes. 400
ReceiptHandleError The receipt handle you provide is not valid. 400
  • Sample requests
    DELETE  /$queueName/messages? receiptHandle=MbZj6wDWli+QEauMZc8ZRv37sIW2iJKq3M9Mx/KSbkJ0HTTP/1.1
        Host: $AccountId.mqs-cn-hangzhou.aliyuncs.com
        Date: Wed, 28 May 2012 22:32:00 GMT
        x-mqs-version: 2014-07-08
        Authorization: MQS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE           
  • Sample responses
        HTTP/1.1 204 NoContent
        x-mqs-request-id:512B2A634403E52B1956133E 
        x-mqs-version: 2015-06-06