Delete message from Azure Storage Queue using REST API

Mike Prager 1 Reputation point
2022-07-25T07:53:53.683+00:00

Hi,

I am trying to simply Get a message off an Azure Storage Queue and then delete it using the REST API. I can retrieve the message and get a popreceipt but when I try and use this to delete the message, I keep getting, "The specified message does not exist."

In the documentation (https://learn.microsoft.com/en-us/rest/api/storageservices/delete-message2) it looks like you only have to supply the popreceipt however further down the page, it says,

After a client retrieves a message with the Get Messages operation, the client is expected to process and delete the message. To delete the message, you must have two items of data returned in the response body of the Get Messages operation:

The message ID, an opaque GUID value that identifies the message in the queue.
A valid pop receipt, an opaque value that indicates that the message has been retrieved.

...so this implies you do need to send the MessageId as well but there is nothing in the docs that specifies where to place the actual messageid?

The URI in the docs says to pass DELETE to https://myaccount.queue.core.windows.net/myqueue/messages/messageid?popreceipt=string-value and I have tried replacing messageid with the actual messageid from the GET but this does not seem to be correct.

Has anyone used this and can explain why I always get "The specified message does not exist" when trying to DELETE the message off the queue or am I missing something?

Thanks in advance

Mike

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,686 questions
Azure Queue Storage
Azure Queue Storage
An Azure service that provides messaging queues in the cloud.
98 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SaiKishor-MSFT 17,186 Reputation points
    2022-08-09T00:04:10.753+00:00

    @Mike Prager I apologize for the time taken while I was reproducing this issue.

    I see that if you use only the popreceipt parameter in the Delete API, it will delete the message. If you try to use the messageID, it throws errors that the message does not exist. However, as you mentioned, the doc mentions the need for the MessageID, I will reach out to the internal team regarding this and will update yon soon. In the meanwhile, please let us know if you have any further questions and we will be glad to assist you further. Thank you!

    Remember:

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.

    Want a reminder to come back and check responses? Here is how to subscribe to a notification.