The blog points to perform simple storage REST API operations such as Get, Put, List 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. 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 mandatory 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 or DELETE as provided by the CURL specifications.
In the below snippet example, a Put operation was performed over the container named testcontainer11 and the blob name is myblob3. The blob type was passed as block blob along with the content of the blob and its length. The blob was created successfully.
You could further validate using Azure Portal or Azure Storage explorer as per your feasibility.
The above example was inclined towards the Block Blob however we can also perform the same over the append blobs as well. Below is how we need to perform the same:
We first need to call the Put Blob operation only with blob type as Append Blob and with Content-Length header as 0
curl --request <http Verb> "<Destination URL>" --header "x-ms-date: <Date and Time in GMT format>" " --header "x-ms-version: 2019-12-12" --header "x-ms-copy-source: <SOURCE URL>" --header "Content-length: 0"
In the below example snippet, we copied the blob named Appointment_confirmation.jpg from the container named testcontainer10 present in the source storage account to a blob named abc.jpg present in destination container named testcontainer present in the destination storage account