Azure Blob Storage REST API
This document provides detailed reference information for the Azure Blob Storage REST API. This API allows you to programmatically manage your blob data in Azure Storage.
Introduction
Azure Blob Storage is a service that stores unstructured data, such as text or binary data. Blob data can be anything that can be stored as a blob, including images, documents, or assembly and binary files. Blob storage is optimized to store massive amounts of unstructured data. Unstructured data is data that doesn't adhere to a particular data model or definition, such as text or binary data.
The Azure Blob Storage REST API is a robust interface for interacting with blob storage. It supports a wide range of operations, from creating and deleting containers to uploading, downloading, and managing individual blobs.
Key Concepts
- Storage Account: A unique namespace in Azure for your data.
- Container: A logical grouping of blobs within a storage account.
- Blob: An object storing data. There are three types of blobs: Block blobs, Append blobs, and Page blobs.
API Operations
GET /\{accountName\}/\{containerName\}/\{blobName\}
Retrieves a blob from the specified container.
Parameters
| Name | Type | Description |
|---|---|---|
accountName |
String | The name of your storage account. |
containerName |
String | The name of the container holding the blob. |
blobName |
String | The name of the blob to retrieve. |
snapshot |
DateTime | (Optional) Specifies a blob snapshot to retrieve. |
timeout |
Integer | (Optional) Specifies the timeout, in seconds, relative to the time the request was initiated. |
Response Codes
| Code | Description |
|---|---|
200 OK |
The blob was successfully retrieved. |
404 Not Found |
The specified blob or container does not exist. |
PUT /\{accountName\}/\{containerName\}/\{blobName\}
Uploads a new blob or overwrites an existing blob.
Parameters
| Name | Type | Description |
|---|---|---|
accountName |
String | The name of your storage account. |
containerName |
String | The name of the container where the blob will be created or overwritten. |
blobName |
String | The name of the blob to upload or overwrite. |
Content-Length |
Integer | The size of the blob in bytes. |
x-ms-blob-type |
Enum | Specifies the type of blob to create. Accepted values are BlockBlob, AppendBlob, and PageBlob. |
timeout |
Integer | (Optional) Specifies the timeout, in seconds. |
Response Codes
| Code | Description |
|---|---|
201 Created |
The blob was successfully created. |
200 OK |
The blob was successfully overwritten. |
400 Bad Request |
The request is malformed. |
DELETE /\{accountName\}/\{containerName\}/\{blobName\}
Deletes a blob from the specified container.
Parameters
| Name | Type | Description |
|---|---|---|
accountName |
String | The name of your storage account. |
containerName |
String | The name of the container holding the blob. |
blobName |
String | The name of the blob to delete. |
snapshot |
DateTime | (Optional) Specifies a blob snapshot to delete. |
x-ms-lease-id |
String | (Optional) If specified, the blob can only be deleted if it has an active lease with the specified ID. |
timeout |
Integer | (Optional) Specifies the timeout, in seconds. |
Response Codes
| Code | Description |
|---|---|
200 OK |
The blob was successfully deleted. |
404 Not Found |
The specified blob does not exist. |
GET /\{accountName\}/\{containerName\}
Lists all blobs within the specified container.
Parameters
| Name | Type | Description |
|---|---|---|
accountName |
String | The name of your storage account. |
containerName |
String | The name of the container. |
prefix |
String | (Optional) Filters the results to return only blobs whose names begin with the specified prefix. |
include |
String | (Optional) Specifies to include a snapshot, metadata, or uncommitted blocks. |
timeout |
Integer | (Optional) Specifies the timeout, in seconds. |
Response Codes
| Code | Description |
|---|---|
200 OK |
The list of blobs was successfully retrieved. |
404 Not Found |
The specified container does not exist. |
Authentication
Requests to the Azure Blob Storage REST API must be authenticated. The primary methods are:
- Shared Key Authentication: Using account key or shared access signatures (SAS).
- Azure Active Directory (Azure AD) Authentication: Using service principals or managed identities.
For detailed information on authentication methods, please refer to the Azure Storage authentication documentation.
Further Reading
Explore more about Azure Blob Storage: