Delete Message

This operation completes the processing of a locked message and deletes it from the queue or subscription. This operation should only be called after successfully processing a previously locked message, in order to maintain At-Least-Once delivery assurances.


Method Request URI HTTP Version
DELETE http{s}://{serviceNamespace}{queuePath}/messages/{messageId|sequenceNumber}/{lockToken}



URI Parameters

The URI is provided in the Location header of the peeked message, or you can construct it from the parts described in the following table.

Parameter Description
messageId The ID of the message to be deleted as returned in BrokerProperties{MessageId} by the Peek Message operation.
sequence-number The sequence number of the message to be deleted as returned in BrokerProperties{SequenceNumber} by the Peek Message operation.
lockToken The token of the lock of the message to be deleted as returned by the Peek Message operation in BrokerProperties{LockToken}.

Request Headers

The following table describes required and optional request headers. In addition to the listed properties, the header can contain custom properties. See the example.

Request Header Description
Authorization Specifies one of the following:

- A WRAPv0.9.7.2 token containing a SimpleWebToken acquired from ACS. Set to WRAP access_token=”{swt}”.
- A SAS token.

Request Body



The response includes an HTTP status code, a set of response headers, and the response body.

Response Codes

Code Description
200 Message successfully deleted.
401 Authorization failure.
404 No message was found with the specified MessageId or LockToken.
410 Specified queue or subscription does not exist.
500 Internal error.

For information about status codes, see Status and Error Codes.

Response Headers

Response Header Description
Content-Type Set to application/atom+xml;type=entry;charset=utf-8.

Response Body



The following HTTP request deletes a message from a queue:

Authorization: SharedAccessSignature sr=rukochbay&sig=rg9iGsK0ZyYlvhIqyH5IS5tqmeb08h8FstjHLPj3%2f8g%3d&se=1404265946&skn=RootManageSharedAccessKey  
Content-Length: 0  

Service Bus returns the following response:

HTTP/1.1 200 OK  
Transfer-Encoding: chunked  
Content-Type: application/xml; charset=utf-8  
Server: Microsoft-HTTPAPI/2.0  
Date: Tue, 01 Jul 2014 23:00:35 GMT  

See Also

Service Bus HTTP Client sample