Azure Table Storage API

The Azure Table storage service is a NoSQL key-attribute store that accepts un Fstructured data. It is ideal for storing large amounts of structured, non-relational data that can be queried rapidly. This section details the REST API operations for interacting with Azure Table Storage.

Core Concepts

Table Storage stores data as entities. Each entity is a set of properties, analogous to a row in a database. Each entity must have two properties:

These two properties together form the unique identifier for an entity.

Key Operations

1. Querying Entities

You can query entities from a table using the GET method. You can query all entities in a table, entities within a specific partition, or a single entity by its PartitionKey and RowKey.

Example: Retrieving all entities in a table

GET https://<your-storage-account-name>.table.core.windows.net/<your-table-name>?sv=<your-sas-token> HTTP/1.1

Example: Retrieving entities with a specific PartitionKey

GET https://<your-storage-account-name>.table.core.windows.net/<your-table-name>(PartitionKey='<your-partition-key>')?sv=<your-sas-token> HTTP/1.1

Example: Retrieving a specific entity by PartitionKey and RowKey

GET https://<your-storage-account-name>.table.core.windows.net/<your-table-name>(PartitionKey='<your-partition-key>',RowKey='<your-row-key>')?sv=<your-sas-token> HTTP/1.1

Note: Queries can include filter expressions to narrow down results. These are specified using OData query syntax.

2. Inserting Entities

To insert entities, use the POST method. The request body should be a JSON object representing the entity, including PartitionKey and RowKey.

POST https://<your-storage-account-name>.table.core.windows.net/<your-table-name>?sv=<your-sas-token> HTTP/1.1
Content-Type: application/json

{
  "PartitionKey": "MyPartition",
  "RowKey": "123",
  "CustomProperty1": "Value1",
  "CustomProperty2": 42
}

Important: You can insert multiple entities in a single batch operation, which is more efficient.

3. Updating Entities

Entities can be updated using MERGE or REPLACE methods.

Example: Merging an entity

MERGE https://<your-storage-account-name>.table.core.windows.net/<your-table-name>(PartitionKey='MyPartition',RowKey='123')?sv=<your-sas-token> HTTP/1.1
Content-Type: application/json

{
  "CustomProperty1": "UpdatedValue1"
}

4. Deleting Entities

Use the DELETE method to remove an entity.

DELETE https://<your-storage-account-name>.table.core.windows.net/<your-table-name>(PartitionKey='MyPartition',RowKey='123')?sv=<your-sas-token> HTTP/1.1

Data Types

Table Storage supports several data types for entity properties:

Type Description
String UTF-16 encoded string.
Int32 32-bit signed integer.
Int64 64-bit signed integer.
Double 64-bit IEEE 754 double-precision floating-point number.
Boolean Boolean value (true or false).
DateTime Date and time value.
Guid GUID (Globally Unique Identifier).
Binary Array of bytes.
String (null) Represents a null string value.

Tip: For optimal performance, design your PartitionKey to distribute your data evenly across partitions.

Further Reading