Query Tables

The Query Tables operation returns a list of tables under the specified account.

Request

You can construct the Query Tables request as follows. We recommend HTTPS. Replace myaccount with the name of your storage account.

Method Request URI HTTP version
GET https://myaccount.table.core.windows.net/Tables HTTP/1.1

Emulated storage service URI

When you're making a request against the emulated storage service, specify the emulator's host name and the table service's port as 127.0.0.1:10002. Follow that information with the name of the emulated storage account.

Method Request URI HTTP version
GET http://127.0.0.1:10002/devstoreaccount1/Tables HTTP/1.1

The Table service in the storage emulator differs from Azure Table Storage in several ways. For more information, see Differences between the storage emulator and Azure Storage services.

URI parameters

The Query Tables operation supports the query options that the OData protocol specification defines.

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 Optional. Specifies the version of the operation to use for this request. For more information, see Versioning for the Azure Storage services.
Accept Optional. Specifies the accepted content type of the response payload. Possible values are:

- application/atom+xml (versions before 2015-12-11 only)
- application/json;odata=nometadata
- application/json;odata=minimalmetadata
- application/json;odata=fullmetadata

For more information, see Payload format for Table Storage operations.
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.

Request body

None.

Response

The response includes an HTTP status code, a set of response headers, and a response body.

Status code

A successful operation returns status code 200 (OK).

For information about status codes, see Status and error codes and Table Storage 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
x-ms-continuation-NextTableName Returns the continuation token value. If the number of tables to be returned exceeds 1,000 or the query doesn't finish within the timeout interval, the response header includes the x-ms-continuation-NextTableName continuation header. For more information about using the continuation token, see Query timeout and pagination.
x-ms-request-id Uniquely identifies the request that was made. You can use it to troubleshoot the request. For more information, see Troubleshoot API operations.
x-ms-version Indicates the version of Table Storage that's used to execute the request. This header is returned for requests made against version 2009-09-19 and later.
Date A UTC date/time value that indicates the time at which the service sent the response.
Content-Type Indicates the content type of the payload. The value depends on the request's Accept header. Possible values are:

- application/atom+xml
- application/json;odata=nometadata
- application/json;odata=minimalmetadata
- application/json;odata=fullmetadata

For more formation about valid content types, see Payload format for Table Storage operations.
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 is at most 1,024 visible ASCII characters. If the x-ms-client-request-id header is not present in the request, this header won't be present in the response.

Response body

The Query Tables operation returns the list of tables in the account as an OData entity set. According to the value of the Accept header, the content is either JSON or an Atom feed.

Note

We recommend JSON as the payload format. It's the only supported format for version 2015-12-11 and later.

JSON (version 2013-08-15 and later)

Here's a sample JSON response body for a Query Tables operation with full metadata:

{  
   "odata.metadata":"https://myaccount.table.core.windows.net/$metadata#Tables",  
   "value":[  
      {  
         "odata.type":"myaccount.Tables",  
         "odata.id":"https://myaccount.table.core.windows.net/Tables('mytable')",  
         "odata.editLink":"Tables('mytable')",  
         "TableName":"mytable"  
      }  
}  

Here's a sample JSON response body for a Query Tables operation with minimal metadata:

{  
    "odata.metadata":"https://myaccount.table.core.windows.net/$metadata#Tables",  
    "value":[{  
        "TableName":"mytable"  
    }]  
}  

Here's a sample JSON response body for a Query Tables operation with no metadata:

{  
   "value":[{  
       "TableName":"mytable"  
   },  
}  

Atom feed (versions before 2015-12-11)

Here's a sample Atom response body for the Query Tables operation:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>  
<feed xml:base="https://myaccount.table.core.windows.net/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">  
  <title type="text">Tables</title>  
  <id>https://myaccount.table.core.windows.net/Tables</id>  
  <updated>2009-01-04T17:18:54.7062347Z</updated>  
  <link rel="self" title="Tables" href="Tables" />  
  <entry>  
    <id>https://myaccount.table.core.windows.net/Tables('mytable')</id>  
    <title type="text"></title>  
    <updated>2009-01-04T17:18:54.7062347Z</updated>  
    <author>  
      <name />  
    </author>  
    <link rel="edit" title="Tables" href="Tables('mytable')" />  
    <category term="myaccount.Tables" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
    <content type="application/xml">  
      <m:properties>  
        <d:TableName>mytable</d:TableName>  
      </m:properties>  
    </content>  
  </entry>  
</feed>   

Authorization

Only the account owner can call this operation.

Remarks

A query against Table Storage can return a maximum of 1,000 tables at one time and run for a maximum of five seconds. The response includes a custom header that contains the x-ms-continuation-NextTableName continuation token in any of the following cases:

  • The result set contains more than 1,000 tables.
  • The query didn't finish within five seconds.
  • The query crosses the partition boundary.

You can use the continuation to construct a subsequent request for the next page of data. For more information about continuation tokens, see Query timeout and pagination.

Note

When you're making subsequent requests that include continuation tokens, be sure to pass the original URI on the request. For example, if you've specified a $filter, $select, or $top query option as part of the original request, include that option on subsequent requests. Otherwise, your subsequent requests might return unexpected results.

The $top query option in this case specifies the maximum number of results per page. It doesn't specify the maximum number of results in the whole response set.

For more information, see Query tables and entities.

The total time allotted to the request for scheduling and processing the query is 30 seconds. That total includes the five seconds for query execution.

For more information about supported query operations against Table Storage through LINQ, see Query operators supported for Table Storage and Write LINQ queries against Table Storage.

See also

Addressing Table Storage resources
Authorize requests to Azure Storage
Set the OData data service version headers
Status and error codes
Table Storage error codes