Loading...

Performing Simple Queue Storage REST API operations using CURL

Performing Simple Queue Storage REST API operations using CURL

The blog points to performing simple Queue REST API operations such as List, Create, Get, Put and Delete using CURL utility.

 

Let’s look at some of the CURL command syntax to perform REST API operations and will be making use of SAS as the auth scheme for most of the operations. We need to take care of the pointers below while performing the operations via CURL:

 

  • Ensure the URL is formed correctly as per the operation you are trying to perform.
  • The header needs to be passed and can be done using “-H” parameter.
  • Ensure you are appending/removing extra ‘?’ to the SAS token in the URLs accordingly.
  • Http verb can be GET, PUT, PATCH or DELETE as provided by the CURL specifications.

 

List Queues

List Queues (REST API) - Azure Storage | Microsoft Learn

 

Syntax:

 

curl -i -X <HTTP Verb> -H "x-ms-version: 2019-12-12" https://<StorageAccountName>.queue.core.windows.net?comp=list&SASToken

 

 

In the below snippet, the operation is being performed on the account and it lists the queues present inside it as below:

Amrinder_Singh_0-1693392695435.png

 

Create Queue

Create Queue (REST API) - Azure Storage | Microsoft Learn

 

Syntax:

 

curl -i -X <HTTP Verb> -H "x-ms-version: 2019-12-12" -H “Content-Length: 0” https://<StorageAccountName>.queue.core.windows.net/<QueueName>?SASToken

 

Amrinder_Singh_1-1693392725959.png

 

In the above sample, we also need to pass Content-Length as 0 to test the same via CURL and create a queue name testqueue7.  You can verify from the portal further as well.

Amrinder_Singh_2-1693392734549.png

 

Delete Queue

Delete Queue (REST API) - Azure Storage | Microsoft Learn

 

Syntax:

 

curl -i -X <HTTP Verb> -H "x-ms-version: 2019-12-12" https://<StorageAccountName>.queue.core.windows.net/<QueueName>?SASToken

 

In the below sample, we delete a queue name testqueue6 successfully.  You can verify from the portal further as well.

Amrinder_Singh_3-1693392790988.png

 

Put Message

Put Message (REST API) - Azure Storage | Microsoft Learn

 

Syntax:

 

curl -i -X <HTTP Verb> -H "x-ms-version: 2019-12-12" -H "Content-Length: <Length of Message>" -H "Content-Type: text/plain" "https://<StorageAccountName>.queue.core.windows.net/<QueueName>/messages?visibilitytimeout=XX&messagettl=XX&SASToken --data "<QueueMessage><MessageText>Message Text</MessageText></QueueMessage> "

 

 

Amrinder_Singh_4-1693392850126.png

 

Get Message

Get Messages (REST API) - Azure Storage | Microsoft Learn

 

Syntax:

 

curl -i -X <HTTP Verb> -H "x-ms-version: 2019-12-12" https://<StorageAccountName>.queue.core.windows.net/<QueueName>/messages?SASToken

 

Amrinder_Singh_5-1693392908037.png

 

 

Delete Message

Delete Message (REST API) - Azure Storage | Microsoft Learn

 

Syntax:

 

curl -i -X <HTTP Verb> -H "x-ms-version: 2019-12-12" https://<StorageAccountName>.queue.core.windows.net/<QueueName>/messages/<messageID>? popreceipt=string-value&SASToken

 

Amrinder_Singh_6-1693392965069.png

 

Clear Queue

Clear Messages (REST API) - Azure Storage | Microsoft Learn

Syntax:

 

curl -i -X <HTTP Verb> -H "x-ms-version: 2019-12-12" https://<StorageAccountName>.queue.core.windows.net/<QueueName>?SASToken

 

In the below sample, we initially added 2 messages to the queue testqueue7 and then performed clear queue operation which deleted all the messages from the queue successfully.  

Amrinder_Singh_7-1693392996638.png

 

Amrinder_Singh_8-1693393001436.png

 

Hope this helps!

Published on:

Learn more
Azure PaaS Blog articles
Azure PaaS Blog articles

Azure PaaS Blog articles

Share post:

Related posts

Azure Storage - TLS 1.0 and 1.1 retirement

Overview TLS 1.0 and 1.1 retirement on Azure Storage was previously announced for Nov 1st, 2024, and it was postponed recently to 1 year later...

1 year ago

Efficient Management of Append and Page Blobs Using Azure Storage Actions

  Overview In Azure Storage, Blob Lifecycle Management (BLM) allows you to automate the management of your data based on rules defined by...

1 year ago

[Azure AI Search] Internal Server Error when creating CMK encrypted objects

Scenario Customers follow the Microsoft doc to create CMK encrypted objects (data source, index etc.), but get the 500 Internal Serv...

1 year ago

Optimizing Azure Table Storage: Automated Data Cleanup using a PowerShell script with Azure Automate

Scenario This blog’s aim is to manage Table Storage data efficiently. Imagine you have a large Azure Table Storage that accumulates logs from ...

1 year ago

Optimizing Azure Table Storage: Automated Data Clean-up using a PowerShell script with Azure Automat

Scenario This blog’s aim is to manage Table Storage data efficiently. Imagine you have a large Azure Table Storage that accumulates logs from ...

1 year ago

Restoring Soft-Deleted Blobs with multithreading in Azure Storage Using C#

Blob soft delete is an essential feature that safeguards your data against accidental deletions or overwrites. By retaining deleted data for a...

1 year ago

Performing simple Azure Table Storage REST API operations using curl command.

The blog provides guidance to perform simple Table Storage REST API operations such as Create table, Delete Table, Insert entity, Delete entit...

1 year ago

Bulk delete all the old jobs from the batch account

Deleting a Job also deletes all Tasks that are part of that Job, and all Job statistics. This also overrides the retention period for Task dat...

1 year ago

Utilizing Azure Storage and Runbooks for scheduled automated backups of Azure SQL Databases

In this article, we are going to provide detailed steps to create a scheduled Azure SQL Database backup to storage account using automation. T...

2 years ago

[Azure Service Bus] JMS messages getting dead-lettered

The article discusses a problem where numerous messages end up in the dead letter queue (DLQ) when the JMS service bus consumer connects to th...

2 years ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy