All Products
Search
Document Center

DeleteMessage

Last Updated: Jul 23, 2019

Description

This interface is used to delete a consumed message. The consumer needs to use the ReceiptHandle returned by the previous consumption as the parameter to locate the message. This operation can be executed successfully only before NextVisibleTime.The ReceiptHandle becomes invalid as the messages turns to Active after the NextVisibleTime expires. You have to acquire a new ReceiptHandle again if you want to execute the deletion.

Request

A request mainly includes the following parts:

  • Request line

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

  • Special URI Parameter

Parameter Name Description Required?
ReceiptHandle ReceiptHandle returned by the previous consumption. For details, see ReceiveMessage Interface. Required
  • Special Request Header

    None. See Public Request Headers.

  • Request Body

    None.

Response

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

  • HTTP Status Code

    HTTP/1.1 204 NoContent

  • Special Response Header

    None. See Public Returned Headers.

  • Response Body

    None.

Special Error

Error Code Error Message 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

Request example:

  1. DELETE /queues/$queueName/messages?ReceiptHandle=MbZj6wDWli+QEauMZc8ZRv37sIW2iJKq3M9Mx/KSbkJ0 HTTP/1.1
  2. Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
  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 204 NoContent
  2. x-mns-request-id:512B2A634403E52B1956133E
  3. x-mns-version: 2015-06-06