Performing simple Azure Table Storage REST API operations using curl command. by info.odysseyx@gmail.com August 23, 2024 written by info.odysseyx@gmail.com August 23, 2024 0 comment 19 views 19 This blog provides instructions on how to perform simple Table storage REST API operations such as create table, drop table, insert entity, delete entity, merge entity, get table properties, get table store statistics, query table, query entity, and update entity operations using curl commands. We will look at some command syntax for performing REST API operations and will use SAS token as an authentication mechanism. You will need to take care of the pointers below while performing the operations via curl command. Make sure the URL is correctly structured for the task you are trying to perform. Required headers must be passed with correct values. You need to add or remove unnecessary ‘?’ from SAS tokens in your URL. The HTTP verb can be GET, PUT or DELETE, depending on the REST API specification. So, shall we begin? Get table storage properties: This Rest API gets the properties of an Azure Table Storage account. Here is the reference link for the Rest API. Get Table Service Properties (REST API) – Azure Storage | Microsoft LearnSyntax URL: curl -X GET "https://.table.core.windows.net/?restype=service&comp=properties" -H "x-ms-date:2024-02-23T03:24Z" -H "x-ms-version:2020-04-08" calculation: Get table storage statistics: This Rest API retrieves statistics related to replication in Azure Table Storage. This operation only works on: 2nd location end point If RAGRS replication is enabled for the storage account. Reference links: Get Table Service Statistics (REST API) – Azure Storage | Microsoft Learn Syntax URL: curl -X GET "https://storageaccount-secondary.table.core.windows.net/?restype=service&comp=stats&” -H "x-ms-date:2024-02-23T03:24Z" -H "x-ms-version:2020-04-08" calculation: question table: This Rest API returns a list of tables under a specified account. Reference Link: Query Tables (REST API) – Azure Storage | Microsoft Learn Syntax URL: curl -X GET "https://storageaccount.table.core.windows.net/Tables?" -H "x-ms-date:2024-02-23T18:16:35Z" -H "x-ms-version:2020-04-08" calculation: Create a table: This Rest API creates a new table in a storage account. Reference links: Create Table (REST API) – Azure Storage | Microsoft Learn Syntax URL: curl -X POST "https://storageaccount.table.core.windows.net/Tables? " -H "x-ms-date:2024-02-23T18:16:35Z" -H "x-ms-version:2020-04-08" -H "Content-Length: 27" -H "Content-Type: application/json" -d "{\"TableName\":\"sampletable\"} calculation: Delete table: This Rest API deletes a table from a storage account. Reference links: Delete Table (REST API) – Azure Storage | Microsoft Learn Syntax URL: curl -X DELETE "https://storageaccount.table.core.windows.net/Tables('sampletable')? " -H "x-ms-date:2024-02-23T18:16:35Z" -H "x-ms-version:2020-04-08" -H "Content-Type: application/json" calculation: Entity query:This Rest API queries entities in a table and includes $filter and $select options. Reference links: Entity Query (REST API) – Azure Storage | Microsoft Learn Syntax URL: curl -X GET "https://storageaccount.table.core.windows.net/shswadsampletable1(PartitionKey='B',RowKey='1')? " -H "x-ms-date:2024-02-24T10:14:50.2646880Z" -H "x-ms-version:2020-04-08" calculation: Delete entity operation:This Rest API deletes an existing entity in a table. Reference link: Delete Entity (REST API) – Azure Storage | Microsoft Learn Syntax URL: curl -X DELETE "https://storageaccount.table.core.windows.net/shswadsampletable1(PartitionKey%3D'B'%2C%20RowKey%3D'1')? " -H "x-ms-date:2024-02-24T11:14:50.2646880Z" -H "x-ms-version:2020-04-08" -H "If-Match:*" calculation: Insert operation: This Rest API inserts a new entity into a table. Reference links: Insert Entity (REST API) – Azure Storage | Microsoft Learn Syntax URL: curl -X POST "https://storageaccount.table.core.windows.net/test? " -H "x-ms-date: 2024-02-25T10:39:50.2646880Z" -H "x-ms-version: 2020-04-08" -H "Accept: application/json;odata=nometadata" -H "Content-Type: application/json" -d "{\"RowKey\":\"bbb\",\"PartitionKey\":\"ssss\",\"Name\":\"aaa\",\"PhoneNumber\":\"111\"}" calculation: Update task: This Rest API updates an existing entity in Table Storage. Reference Links: Update Entity (REST API) – Azure Storage | Microsoft Learn Syntax URL: curl -X PUT "https://storageaccount.table.core.windows.net/test(PartitionKey%3D'ss'%2C%20RowKey%3D'bbb')? " -H "x-ms-date: 2024-02-25T10:39:50.2646880Z" -H "x-ms-version: 2020-04-08" -H "Accept: application/json;odata=nometadata" -H "Content-Type: application/json" -H "If-Match=*" -d "{\"RowKey\":\"bbb\",\"PartitionKey\":\"ssss\",\"Name\":\"aaa\",\"PhoneNumber\":\"111\"} calculation Merge operation:This Rest API operation updates an existing entity by updating the properties of the entity and does not replace the existing entity. Reference links: Merge Entities (REST API) – Azure Storage | Microsoft Learn Syntax URL: curl -X PUT "https://storageaccount.table.core.windows.net/test(PartitionKey%3D'ssss'%2C%20RowKey%3D'bbb')? " -H "x-ms-version: 2020-04-08" -H "Accept: application/json;odata=nometadata" -H "Content-Type: application/json" -H "If-Match=*" -d "{\"RowKey\":\"bbb\",\"PartitionKey\":\"ssss\",\"Name\":\"aaa\",\"PhoneNumber\":\"11231\"}" calculation: I hope this article will help you perform table save operations using the curl command. Have fun learning! Source link Share 0 FacebookTwitterPinterestEmail info.odysseyx@gmail.com previous post California Consumer Privacy Act (CCPA) Opt-Out Icon next post Implementing Data Vault 2.0 on Fabric Data Warehouse You may also like Galaxy S25 Ultra how finally removed me from my iPhone addiction March 20, 2025 Low Earth orbital networks are pressing for the innovation of geostationary giants March 19, 2025 AI Chattbots ‘Zero-Jnan’ may be easy victims for hackers March 18, 2025 Sevatton Dual Screen turns ad-on laptops into triple display March 17, 2025 Microprocessor market problems with market conditions and tariffs March 17, 2025 Believe Hyp about Quantum Protection: Report March 11, 2025 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment.