Get Block List

The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob.

There are two blocklists maintained for a blob:

  • Committed Block List: The list of blocks that have been successfully committed to a specified blob by using Put Block List.

  • Uncommitted Block List: The list of blocks that have been uploaded for a blob by using Put Block, but that haven't yet been committed. These blocks are stored in Azure in association with a blob, but don't yet form part of the blob.

You can call Get Block List to return the committed blocklist, the uncommitted blocklist, or both lists. You can also call this operation to retrieve the committed blocklist for a snapshot.

Request

The Get Block List request may be constructed as follows. We recommend that you use HTTPS. Replace myaccount with the name of your storage account:

GET method request URI HTTP version
https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=blocklist

https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=blocklist&snapshot=<DateTime>

https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=blocklist&versionid=<DateTime>
HTTP/1.1

Emulated storage service request

When making a request against the emulated storage service, specify the emulator hostname and Blob service port as 127.0.0.1:10000, followed by the emulated storage account name:

GET method request URI HTTP version
http://127.0.0.1:10000/devstoreaccount1/mycontainer/myblob?comp=blocklist HTTP/1.1

For more information, see Use the Azurite emulator for local Azure Storage development.

URI parameters

You can specify the following additional parameters on the request URI:

URI parameter Description
snapshot Optional. The snapshot parameter is an opaque DateTime value that, when present, specifies the blob list to retrieve. For more information about working with blob snapshots, see Create a snapshot of a blob.
versionid Optional for versions 2019-12-12 and later. The versionid parameter is an opaque DateTime value that, when present, specifies the version of the blob to retrieve.
blocklisttype Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together. Valid values are committed, uncommitted, or all. If you omit this parameter, Get Block List returns the list of committed blocks.
timeout Optional. The timeout parameter is expressed in seconds. For more information, see Set time-outs for Blob Storage operations.

Request headers

The following table describes required and optional request headers.

Request header Description
Authorization Required. Specifies the authorization scheme, account name, and signature. For more information, see Authorize requests to Azure Storage.
Date or x-ms-date Required. Specifies the Coordinated Universal Time (UTC) for the request. For more information, see Authorize requests to Azure Storage.
x-ms-version Required for all authorized requests, optional for anonymous requests. Specifies the version of the operation to use for this request. For more information, see Versioning for the Azure Storage services.
x-ms-lease-id:<ID> Optional. If this header is specified, the operation will be performed only if both of the following conditions are met:

- The blob's lease is currently active.
- The lease ID specified in the request matches that of the blob.

If this header is specified and either condition isn't met, the request fails, and the operation fails with status code 412 (Precondition Failed).
x-ms-client-request-id Optional. Provides a client-generated, opaque value with a 1-kibibyte (KiB) character limit that's recorded in the logs when logging is configured. We highly recommend that you use this header to correlate client-side activities with requests that the server receives. For more information, see Monitor Azure Blob Storage.

This operation also supports the use of conditional headers to execute the operation only if a specified condition is met. For more information, see Specify conditional headers for Blob Storage operations.

Request body

None.

Sample request

The following sample request URI returns the committed blocklist for a blob named MOV1.avi:

GET http://myaccount.blob.core.windows.net/movies/MOV1.avi?comp=blocklist&blocklisttype=committed HTTP/1.1

The following sample request URI returns both the committed and the uncommitted blocklist:

GET http://myaccount.blob.core.windows.net/movies/MOV1.avi?comp=blocklist&blocklisttype=all HTTP/1.1

The following sample request URI returns the committed blocklist for a snapshot. A snapshot consists only of committed blocks, so there are no uncommitted blocks associated with it.

GET http://myaccount.blob.core.windows.net/mycontainer/myblob?comp=blocklist&snapshot=2009-09-30T20%3a11%3a15.2735974Z

Response

The response includes an HTTP status code, a set of response headers, and a response body that contains the list of blocks.

Status code

A successful operation returns status code 200 (OK).

For information about status codes, see Status and error codes.

Response headers

The response for this operation includes the following headers. The response might also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response header Description
Last-Modified The date/time when the blob was last modified. The date format follows RFC 1123. For more information, see Represent date/time values in headers. Returned only if the blob has committed blocks.

Any operation that modifies the blob, including updates to the blob's metadata or properties, changes the last modified time of the blob.
ETag The ETag for the blob. Returned only if the blob has committed blocks.
Content-Type The MIME content type of the blob. The default value is application/xml.
x-ms-blob-content-length The size of the blob in bytes.
x-ms-request-id This header uniquely identifies the request that was made, and it can be used to troubleshoot the request. For more information, see Troubleshoot API operations.
x-ms-version Indicates the service version that was used to execute the request. This header is returned for requests made against version 2009-09-19 and later.

This header is also returned for anonymous requests without a specified version if the container was marked for public access by using Blob Storage version 2009-09-19. Note: Only the committed blocklist can be returned via an anonymous request.
Date A UTC date/time value that's generated by the service, which indicates the time when the response was initiated.
x-ms-client-request-id Can be used to troubleshoot requests and corresponding responses. The value of this header is equal to the value of the x-ms-client-request-id header if it's present in the request and the value contains no more than 1,024 visible ASCII characters. If the x-ms-client-request-id header isn't present in the request, it isn't present in the response.

This operation also supports the use of conditional headers to get the blocklist only if a specified condition is met. For more information, see Specify conditional headers for Blob Storage operations.

Response body

The format of the response body for a request that returns only committed blocks is as follows:

<?xml version="1.0" encoding="utf-8"?>
<BlockList>
  <CommittedBlocks>
    <Block>
      <Name>base64-encoded-block-id</Name>
      <Size>size-in-bytes</Size>
    </Block>
  <CommittedBlocks>
</BlockList>

The format of the response body for a request that returns both committed and uncommitted blocks is as follows:


<?xml version="1.0" encoding="utf-8"?>
<BlockList>
  <CommittedBlocks>
     <Block>
        <Name>base64-encoded-block-id</Name>
        <Size>size-in-bytes</Size>
     </Block>
  </CommittedBlocks>
  <UncommittedBlocks>
    <Block>
      <Name>base64-encoded-block-id</Name>
      <Size>size-in-bytes</Size>
    </Block>
  </UncommittedBlocks>
 </BlockList>

Sample response

In the following example, the blocklisttype parameter was set to committed, so only the blob's committed blocks are returned in the response.

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/xml
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 42da571d-34f4-4d3e-b53e-59a66cb36f23
Date: Sun, 25 Sep 2011 00:33:19 GMT

<?xml version="1.0" encoding="utf-8"?>
<BlockList>
  <CommittedBlocks>
    <Block>
      <Name>BlockId001</Name>
      <Size>4194304</Size>
    </Block>
    <Block>
      <Name>BlockId002</Name>
      <Size>4194304</Size>
    </Block>
  </CommittedBlocks>
</BlockList>

In this example, the blocklisttype parameter was set to all, and both the blob's committed and uncommitted blocks are returned in the response.

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/xml
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 42da571d-34f4-4d3e-b53e-59a66cb36f23
Date: Sun, 25 Sep 2011 00:35:56 GMT

<?xml version="1.0" encoding="utf-8"?>
<BlockList>
  <CommittedBlocks>
    <Block>
      <Name>BlockId001</Name>
      <Size>4194304</Size>
    </Block>
    <Block>
      <Name>BlockId002</Name>
      <Size>4194304</Size>
    </Block>
  </CommittedBlocks>
  <UncommittedBlocks>
    <Block>
      <Name>BlockId003</Name>
      <Size>4194304</Size>
    </Block>
    <Block>
      <Name>BlockId004</Name>
      <Size>1024000</Size>
    </Block>
  </UncommittedBlocks>
</BlockList>

In this next example, the blocklisttype parameter was set to all, but the blob hasn't yet been committed, so the CommittedBlocks element is empty.

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/xml
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 42da571d-34f4-4d3e-b53e-59a66cb36f23
Date: Wed, 14 Sep 2011 00:40:22 GMT

<?xml version="1.0" encoding="utf-8"?>
<BlockList>
  <CommittedBlocks />
  <UncommittedBlocks>
    <Block>
      <Name>BlockId001</Name>
      <Size>1024</Size>
    </Block>
    <Block>
      <Name>BlockId002</Name>
      <Size>1024</Size>
    </Block>
    <Block>
      <Name>BlockId003</Name>
      <Size>1024</Size>
    </Block>
    <Block>
      <Name>BlockId004</Name>
      <Size>1024</Size>
    </Block>
  </UncommittedBlocks>
</BlockList>

Authorization

Authorization is required when calling any data access operation in Azure Storage. You can authorize the Get Block List operation as described below.

Azure Storage supports using Microsoft Entra ID to authorize requests to blob data. With Microsoft Entra ID, you can use Azure role-based access control (Azure RBAC) to grant permissions to a security principal. The security principal may be a user, group, application service principal, or Azure managed identity. The security principal is authenticated by Microsoft Entra ID to return an OAuth 2.0 token. The token can then be used to authorize a request against the Blob service.

To learn more about authorization using Microsoft Entra ID, see Authorize access to blobs using Microsoft Entra ID.

Permissions

Listed below are the RBAC action necessary for a Microsoft Entra user, group, or service principal to call the Get Block List operation, and the least privileged built-in Azure RBAC role that includes this action:

To learn more about assigning roles using Azure RBAC, see Assign an Azure role for access to blob data.

Remarks

Call Get Block List to return the list of blocks that have been committed to a block blob, the list of blocks that haven't yet been committed, or both lists. Use the blocklisttype parameter to specify which list of blocks to return. The list of committed blocks is returned in the same order that they were committed by the Put Block List operation.

You can use the uncommitted blocklist to determine which blocks are missing from the blob in cases where calls to Put Block or Put Block List have failed. The list of uncommitted blocks is returned in alphabetical order. If a block ID has been uploaded more than once, only the most recently uploaded block appears in the list.

Note

When a blob hasn't yet been committed, calling Get Block List with blocklisttype=all returns the uncommitted blocks, and the CommittedBlocks element is empty.

Get Block List doesn't support concurrency when it reads the list of uncommitted blocks. Calls to Get Block List where blocklisttype=uncommitted or blocklisttype=all have a lower maximum request rate than other read operations. For details on target throughput for read operations, see Azure Storage scalability and performance targets.

As of version 2019-12-12, a block blob can contain blocks of up to 4000 mebibytes (MiB). To protect applications that use a signed 32-bit integer to represent the block size, calling Get Block List on a block blob that contains a block larger than 100 MiB with a REST version earlier than 2019-12-12 results in status code 409 (Conflict).

Get Block List applies only to block blobs. Calling Get Block List on a page blob results in status code 400 (Bad Request).

Get Block List on an archived block blob will fail.

Billing

Pricing requests can originate from clients that use Blob Storage APIs, either directly through the Blob Storage REST API, or from an Azure Storage client library. These requests accrue charges per transaction. The type of transaction affects how the account is charged. For example, read transactions accrue to a different billing category than write transactions. The following table shows the billing category for Get Block List requests based on the storage account type:

Operation Storage account type Billing category
Get Block List Premium block blob
Standard general-purpose v2
Other operations
Get Block List Standard general-purpose v1 Read operations

To learn about pricing for the specified billing category, see Azure Blob Storage Pricing.

See also

Authorize requests to Azure Storage Status and error codes Blob Storage error codes Set time-outs for Blob Storage operations