Amazon Simple Queue Service
API Reference (API Version 2012-11-05)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

DeleteMessageBatch

Description

Deletes multiple messages. This is a batch version of DeleteMessage. The result of the delete action on each message is reported individually in the response.

Important

Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of 200.

Note

Some API actions take lists of parameters. These lists are specified using the param.n notation. Values of n are integers starting from 1. For example, a parameter list with two elements looks like this:

&Attribute.1=this

&Attribute.2=that

Request Parameters

For information about the common parameters that all actions use, see Common Parameters.

DeleteMessageBatchRequestEntry.member.N

A list of receipt handles for the messages to be deleted.

Type: DeleteMessageBatchRequestEntry list

Required: Yes

QueueUrl

The URL of the Amazon SQS queue to take action on.

Type: String

Required: Yes

Response Elements

The following elements are returned in a structure named DeleteMessageBatchResult.

Failed

A list of BatchResultErrorEntry items.

Type: BatchResultErrorEntry list

Successful

A list of DeleteMessageBatchResultEntry items.

Type: DeleteMessageBatchResultEntry list

Errors

For information about the errors that are common to all actions, see Common Errors.

BatchEntryIdsNotDistinct

Two or more batch entries have the same Id in the request.

HTTP Status Code: 400

EmptyBatchRequest

Batch request does not contain an entry.

HTTP Status Code: 400

InvalidBatchEntryId

The Id of a batch entry in a batch request does not abide by the specification.

HTTP Status Code: 400

TooManyEntriesInBatchRequest

Batch request contains more number of entries than permissible.

HTTP Status Code: 400

Examples

The following example DeleteMessageBatch request deletes two messages. You must URL encode the entire URL; however, we've URL encoded only the message body to make the example easier for you to read.

Sample Request

        
http://sqs.us-east-1.amazonaws.com/123456789012/testQueue/
&Action=DeleteMessageBatch
&Version=2011-10-01
&DeleteMessageBatchRequestEntry.1.Id=msg1
&DeleteMessageBatchRequestEntry.1.ReceiptHandle=gfk0T0R0waama4fVFffkjPQrrvzMrOg0fTFk2LxT33EuB8wR0ZCFgKWyXGWFoqqpCIiprQUEhir%2F5LeGPpYTLzjqLQxyQYaQALeSNHb0us3uE84uujxpBhsDkZUQkjFFkNqBXn48xlMcVhTcI3YLH%2Bd%2BIqetIOHgBCZAPx6r%2B09dWaBXei6nbK5Ygih21DCDdAwFV68Jo8DXhb3ErEfoDqx7vyvC5nCpdwqv%2BJhU%2FTNGjNN8t51v5c%2FAXvQsAzyZVNapxUrHIt4NxRhKJ72uICcxruyE8eRXlxIVNgeNP8ZEDcw7zZU1Zw%3D%3D
&DeleteMessageBatchRequestEntry.2.Id=msg2
&DeleteMessageBatchRequestEntry.2.ReceiptHandle=gfk0T0R0waama4fVFffkjKzmhMCymjQvfTFk2LxT33G4ms5subrE0deLKWSscPU1oD3J9zgeS4PQQ3U30qOumIE6AdAv3w%2F%2Fa1IXW6AqaWhGsEPaLm3Vf6IiWqdM8u5imB%2BNTwj3tQRzOWdTOePjOjPcTpRxBtXix%2BEvwJOZUma9wabv%2BSw6ZHjwmNcVDx8dZXJhVp16Bksiox%2FGrUvrVTCJRTWTLc59oHLLF8sEkKzRmGNzTDGTiV%2BYjHfQj60FD3rVaXmzTsoNxRhKJ72uIHVMGVQiAGgB%2BqAbSqfKHDQtVOmJJgkHug%3D%3D
&SignatureMethod=HmacSHA256
&Expires=2011-10-18T22%3A52%3A43PST
&AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE
&SignatureVersion=2
&Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQEXAMPLE

      

Sample Response

        
<DeleteMessageBatchResponse>
    <DeleteMessageBatchResult>
        <DeleteMessageBatchResultEntry>
            <Id>msg1</Id>
        </DeleteMessageBatchResultEntry>
        <DeleteMessageBatchResultEntry>
            <Id>msg2</Id>
        </DeleteMessageBatchResultEntry>
    </DeleteMessageBatchResult>
    <ResponseMetadata>
        <RequestId>d6f86b7a-74d1-4439-b43f-196a1e29cd85</RequestId>
    </ResponseMetadata>
</DeleteMessageBatchResponse>