The List Blobs operation enumerates the list of blobs under the specified container.
Request
The List Blobs request may be constructed as follows. HTTPS is recommended. Replace myaccount with the name of your storage account:
| Method | Request URI | HTTP Version |
|---|---|---|
GET |
https://myaccount.blob.core.windows.net/mycontainer?restype=container&comp=list |
HTTP/1.1 |
Emulated Storage Service URI
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:
| Method | Request URI | HTTP Version |
|---|---|---|
GET |
http://127.0.0.1:10000/devstoreaccount1/mycontainer?restype=container&comp=list |
HTTP/1.1 |
For more information, see Using the Azure Storage Emulator for Development and Testing.
URI Parameters
The following additional parameters may be specified on the URI.
| Parameter | Description |
|---|---|
prefix |
Optional. Filters the results to return only blobs whose names begin with the specified prefix. |
delimiter |
Optional. When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string. |
marker |
Optional. A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. |
maxresults |
Optional. Specifies the maximum number of blobs to return, including all BlobPrefix elements. If the request does not specify maxresults or specifies a value greater than 5,000, the server will return up to 5,000 items.Setting maxresults to a value less than or equal to zero results in error response code 400 (Bad Request). |
include={snapshots,metadata,uncommittedblobs,copy} |
Optional. Specifies one or more datasets to include in the response: - snapshots: Specifies that snapshots should be included in the enumeration. Snapshots are listed from oldest to newest in the response.- metadata: Specifies that blob metadata be returned in the response.- uncommittedblobs: Specifies that blobs for which blocks have been uploaded, but which have not been committed using Put Block List, be included in the response.- copy: Version 2012-02-12 and newer. Specifies that metadata related to any current or previous Copy Blob operation should be included in the response.To specify more than one of these options on the URI, you must separate each option with a URL-encoded comma ("%82"). |
timeout |
Optional. The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations. |
Request Headers
The following table describes required and optional request headers.
| Request Header | Description |
|---|---|
Authorization |
Required. Specifies the authentication scheme, account name, and signature. For more information, see Authentication for the Azure Storage Services. |
Date or x-ms-date |
Required. Specifies the Coordinated Universal Time (UTC) for the request. For more information, see Authentication for the Azure Storage Services. |
x-ms-version |
Required for all authenticated 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-client-request-id |
Optional. Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. Using this header is highly recommended for correlating client-side activities with requests received by the server. For more information, see About Storage Analytics Logging and Azure Logging: Using Logs to Track Storage Requests. |
Request Body
None.
Sample Request
See Enumerating Blob Resources for a sample request.
Response
The response includes an HTTP status code, a set of response headers, and a response body in XML format.
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 may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.
| Response header | Description |
|---|---|
Content-Type |
Specifies the format in which the results are returned. Currently this value is application/xml. |
x-ms-request-id |
This header uniquely identifies the request that was made and can be used for troubleshooting the request. For more information, see Troubleshooting API Operations. |
x-ms-version |
Indicates the version of the Blob service used to execute the request. This header is returned for requests made using version 2009-09-19 and newer. This header is also returned for anonymous requests without a version specified if the container was marked for public access using the 2009-09-19 version of the Blob service. |
Date |
A UTC date/time value generated by the service that indicates the time at which the response was initiated. |
Response Body
The format of the XML response is as follows.
Note that the Prefix, Marker, MaxResults, and Delimiter elements are present only if they were specified on the request URI. The NextMarker element has a value only if the list results are not complete.
Snapshots, blob metadata, and uncommitted blobs are included in the response only if they are specified with the include parameter on the request URI.
In version 2009-09-19 and newer, the blob's properties are encapsulated within a Properties element.
Beginning with version 2009-09-19, List Blobs returns the following renamed elements in the response body:
Last-Modified(previouslyLastModified)Content-Length(previouslySize)Content-Type(previouslyContentType)Content-Encoding(previouslyContentEncoding)Content-Language(previouslyContentLanguage)The
Content-MD5element appears for blobs created with version 2009-09-19 and newer. In version 2012-02-12 and newer, the Blob service calculates theContent-MD5value when you upload a blob using Put Blob, but does not calculate this when you create a blob using Put Block List. You can explicitly set theContent-MD5value when you create the blob, or by calling Put Block List or Set Blob Properties operations.For versions from 2009-09-19 and newer but prior to version 2015-02-21, calling
List Blobson a container that includes append blobs will fail with status code 409 (FeatureVersionMismatch) if the result of listing contains an append blob.LeaseStateandLeaseDurationappear only in version 2012-02-12 and later.CopyId,CopyStatus,CopySource,CopyProgress,CopyCompletionTime, andCopyStatusDescriptiononly appear in version 2012-02-12 and later, when this operation includes theinclude={copy}parameter. These elements do not appear if this blob has never been the destination in aCopy Bloboperation, or if this blob has been modified after a concludedCopy Bloboperation usingSet Blob Properties,Put Blob, orPut Block List. These elements also do not appear with a blob created by Copy Blob before version 2012-02-12.In version 2013-08-15 and newer, the
EnumerationResultselement contains aServiceEndpointattribute specifying the blob endpoint, and aContainerNamefield specifying the name of the container. In previous versions these two attributes were combined together in theContainerNamefield. Also in version 2013-08-15 and newer, theUrlelement underBlobhas been removed.For version 2015-02-21 and above,
List Blobsreturns blobs of all types (block, page, and append blobs).For version 2015-12-11 and above,
List Blobsreturns theServerEncryptedelement. This element is set totrueif the blob and application metadata are completely encrypted, andfalseotherwise.For version 2016-05-31 and above,
List Blobsreturns theIncrementalCopyelement for incremental copy blobs and snapshots with the value set totrue.For version 2017-04-17 and above,
List Blobsreturns theAccessTierelement if an access tier has been explicitly set. For a list of allowed premium page blob tiers, see High-performance Premium Storage and managed disks for VMs. For blob storage LRS accounts, valid values areHot/Cool/Archive. Tiers on standard blob accounts are currently in preview. For detailed information about standard blob LRS account block blob level tiering see Hot, cool and archive storage tiers.
<?xml version="1.0" encoding="utf-8"?>
<EnumerationResults ServiceEndpoint="http://myaccount.blob.core.windows.net/" ContainerName="mycontainer">
<Prefix>string-value</Prefix>
<Marker>string-value</Marker>
<MaxResults>int-value</MaxResults>
<Delimiter>string-value</Delimiter>
<Blobs>
<Blob>
<Name>blob-name</name>
<Snapshot>date-time-value</Snapshot>
<Properties>
<Last-Modified>date-time-value</Last-Modified>
<Etag>etag</Etag>
<Content-Length>size-in-bytes</Content-Length>
<Content-Type>blob-content-type</Content-Type>
<Content-Encoding />
<Content-Language />
<Content-MD5 />
<Cache-Control />
<x-ms-blob-sequence-number>sequence-number</x-ms-blob-sequence-number>
<BlobType>BlockBlob|PageBlob|AppendBlob</BlobType>
<AccessTier>tier</AccessTier>
<LeaseStatus>locked|unlocked</LeaseStatus>
<LeaseState>available | leased | expired | breaking | broken</LeaseState>
<LeaseDuration>infinite | fixed</LeaseDuration>
<CopyId>id</CopyId>
<CopyStatus>pending | success | aborted | failed </CopyStatus>
<CopySource>source url</CopySource>
<CopyProgress>bytes copied/bytes total</CopyProgress>
<CopyCompletionTime>datetime</CopyCompletionTime>
<CopyStatusDescription>error string</CopyStatusDescription>
<ServerEncrypted>true</ServerEncrypted>
<IncrementalCopy>true</IncrementalCopy>
</Properties>
<Metadata>
<Name>value</Name>
</Metadata>
</Blob>
<BlobPrefix>
<Name>blob-prefix</Name>
</BlobPrefix>
</Blobs>
<NextMarker />
</EnumerationResults>
Sample Response
See Enumerating Blob Resources for a sample response.
Authorization
If the container's access control list (ACL) is set to allow anonymous access to the container, any client may call this operation. Otherwise, this operation can be called by the account owner and by anyone with a Shared Access Signature that has permission to list blobs in a container.
Remarks
Blob Properties in the Response
If you have requested that uncommitted blobs be included in the enumeration, note that some properties are not set until the blob is committed, so some properties may not be returned in the response.
The x-ms-blob-sequence-number element is only returned for page blobs.
For page blobs, the value returned in the Content-Length element corresponds to the value of the blob's x-ms-blob-content-length header.
The Content-MD5 element appears in the response body only if it has been set on the blob using version 2009-09-19 or later. You can set the Content-MD5 property when the blob is created or by calling Set Blob Properties. In version 2012-02-12 and newer, Put Blob sets a block blob’s MD5 value even when the Put Blob request doesn’t include an MD5 header.
Metadata in the Response
The Metadata element is present only if the include=metadata parameter was specified on the URI. Within the Metadata element, the value of each name-value pair is listed within an element corresponding to the pair's name.
Note that metadata requested with this parameter must be stored in accordance with the naming restrictions imposed by the 2009-09-19 version of the Blob service. Beginning with this version, all metadata names must adhere to the naming conventions for C# identifiers.
If a metadata name-value pair violates the naming restrictions enforced by the 2009-09-19 version, the response body indicates the problematic name within an x-ms-invalid-name element, as shown in the following XML fragment:
…
<Metadata>
<MyMetadata1>first value</MyMetadata1>
<MyMetadata2>second value</MyMetadata2>
<x-ms-invalid-name>invalid-metadata-name</x-ms-invalid-name>
</Metadata>
…
Snapshots in the Response
Snapshots are listed in the response only if the include=snapshots parameter was specified on the URI. Snapshots listed in the response do not include the LeaseStatus element, as snapshots cannot have active leases.
If you call List Blobs with a delimiter, you cannot also include snapshots in the enumeration. A request that includes both returns an InvalidQueryParameter error (HTTP status code 400 – Bad Request).
Uncommitted Blobs in the Response
Uncommitted blobs are listed in the response only if the include=uncommittedblobs parameter was specified on the URI. Uncommitted blobs listed in the response do not include any of the following elements:
Last-ModifiedEtagContent-TypeContent-EncodingContent-LanguageContent-MD5Cache-ControlMetadataReturning Result Sets Using a Marker Value
If you specify a value for the
maxresultsparameter and the number of blobs to return exceeds this value, or exceeds the default value formaxresults, the response body will contain aNextMarkerelement that indicates the next blob to return on a subsequent request. To return the next set of items, specify the value ofNextMarkeras the marker parameter on the URI for the subsequent request.Note that the value of
NextMarkershould be treated as opaque.Using a Delimiter to Traverse the Blob Namespace
The
delimiterparameter enables the caller to traverse the blob namespace by using a user-configured delimiter. In this way, you can traverse a virtual hierarchy of blobs as though it were a file system. The delimiter may be a single character or a string. When the request includes this parameter, the operation returns aBlobPrefixelement. TheBlobPrefixelement is returned in place of all blobs whose names begin with the same substring up to the appearance of the delimiter character. The value of theBlobPrefixelement is substring+delimiter, where substring is the common substring that begins one or more blob names, and delimiter is the value of the delimiter parameter.You can use the value of
BlobPrefixto make a subsequent call to list the blobs that begin with this prefix, by specifying the value ofBlobPrefixfor theprefixparameter on the request URI.Note that each
BlobPrefixelement returned counts toward the maximum result, just as eachBlobelement does.Blobs are listed in alphabetical order in the response body, with upper-case letters listed first.
Copy errors in CopyStatusDescription
CopyStatusDescriptioncontains more information about theCopy Blobfailure.When a copy attempt fails and the Blob service is still retrying the operation,
CopyStatusis set topending, and theCopyStatusDescriptiontext describes the failure that may have occurred during the last copy attempt.When
CopyStatusis set tofailed, theCopyStatusDescriptiontext describes the error that caused the copy operation to fail.The following table describes the three fields of every
CopyStatusDescriptionvalue.
| Component | Description |
|---|---|
| HTTP status code | Standard 3-digit integer specifying the failure. |
| Error code | Keyword describing error that is provided by Azure in the |
| Information | Detailed description of failure, in quotes. |
The following table describes the CopyStatus and CopyStatusDescription values of common failure scenarios.
Important
Description text shown here can change without warning, even without a version change, so do not rely on matching this exact text.
| Scenario | CopyStatus value | CopyStatusDescription value |
|---|---|---|
| Copy operation completed successfully. | success | empty |
| User aborted copy operation before it completed. | aborted | empty |
| A failure occurred when reading from the source blob during a copy operation, but the operation will be retried. | pending | 502 BadGateway "Encountered a retryable error when reading the source. Will retry. Time of failure: |
| A failure occurred when writing to the destination blob of a copy operation, but the operation will be retried. | pending | 500 InternalServerError "Encountered a retryable error. Will retry. Time of failure: |
| An unrecoverable failure occurred when reading from the source blob of a copy operation. | failed | 404 ResourceNotFound "Copy failed when reading the source." Note: When reporting this underlying error, Azure returns ResourceNotFound in the NotFound would appear. |
| The timeout period limiting all copy operations elapsed. (Currently the timeout period is 2 weeks.) | failed | 500 OperationCancelled "The copy exceeded the maximum allowed time." |
| The copy operation failed too often when reading from the source, and didn’t meet a minimum ratio of attempts to successes. (This timeout prevents retrying a very poor source over 2 weeks before failing). | failed | 500 OperationCancelled "The copy failed when reading the source." |



