Listing account metadata
You use the HTTP HEAD method to list account metadata. You need an account to request this operation.
The target of a request to list the account metadata is a tenant (that is, the service point). When you list account metadata, you are returned information about the total number of containers on that account, the number of objects in the account, and the total amount of bytes used.
The total number of containers is calculated in the context of that tenant and even incorporates containers that don't have the HSwift API enabled. The object count is calculated in the same manner.
Request line
Depending on whether the HSwift request uses a Keystone tenant ID or the account name, the request line for a request to list account containers has either of these formats:
- With the Keystone tenant ID:
HEAD /swift/v1/tenant-ID HTTP/1.1
- With the account name:
HEAD /swift/v1/account-name HTTP/1.1
Request headers
The table below describes the headers you can use in a request to list account container data.
Name | Type | Description |
X-Auth-Token | String |
Used to supply the Keystone authentication token or local authentication token. Replace the Keystone authentication token with the prefix HCP, followed by your Local Authentication token, in the format: "X-Auth-Token: HCP base64-encoded-username:md5-encoded-password" For example: "X-Auth-Token: HCP bGdyZWVu:a3b9c163f6c520407ff34cfdb83ca5c6" |
Response headers
The table below describes the response headers returned in response to a successful request to list account container data.
Name | Type | Description |
Content-length | String (Required) |
The size, in bytes, of the response body if HCP can determine the size before formulating the response. If the response does not include a response body, the value of the |
Content-Type | String (Required if the Content-Length is greater than 0) |
The Internet media type of the response body if HCP can determine the Internet media type. If HCP cannot determine the Internet media type, the value of this header is Because HCP returns error information in a response body, the response to any request can include a |
Date | Datetime (Required) |
The date and time at which HCP responded to the request in Greenwich Mean Time (GMT). The date and time are returned in this format: DDD dd MMM yyyy HH:mm:ss GMT For example: Thu, 14 Mat 2013 14:27:05 GMT |
X-Account-Bytes-Used | Int (Required) | This number is the total amount of bytes stored in object storage by this account. The number includes to total amount of bytes across all objects in all containers on the account. |
X-Account-Container-Count | Int (Required) |
The number of containers on the account. This number is limited to the total number of namespaces that an HCP tenant may have which is 10,000. |
X-Account-Object-Count | Int (Required) | This number is the total amount of objects that the account has across all of its containers. |
X-Trans-Id | Uuid (Required) | HCP returns a universally unique identifier (UUID). This UUID does not map to any entries in the HCP database. |
HTTP response codes
The table below describes HTTP status codes that can be returned in response to a request to list account container data.
Code | Meaning | Description |
204 | Success | If the request succeeds, the operation returns this code. |
401 | Unauthorized | If you do not have the permissions to view the account's container data. |
500 | Internal Server Error |
An internal error occurred. If this error persists, contact your tenant administrator. |
503 | Service Unavailable |
HCP is temporarily unable to handle the request, probably due to system overload, maintenance, or upgrade. Try the request again, gradually increasing the delay between each successive attempt. If this error persists, contact your tenant administrator. |
Example: Listing an account's metadata
Here's a sample HEAD request that lists the metadata of an account named europe.
Request with curl command line
curl -i -X HEAD http://api.hcp.example.com/swift/v1/AUTH_6b6884ebb6f441cfbb7e740f6a927c9e -H "X-Auth-Token: dc5efec8f546455eac974e7bbfd0dd87"
Request headers
HEAD /swift/v1/AUTH_6b6884ebb6f441cfbb7e740f6a927c9e HTTP/1.1 X-Auth-Token: dc5efec8f546455eac974e7bbfd0dd87
Response headers
HTTP/1.1 204 No Content Date: Fri, 31 Oct 2014 12:53:19 GMT X-Trans-Id: 47b950a0-2e0d-4c25-86a3-fbd709b55a08 X-Account-Object-Count: 7 X-Account-Container-Count: 2 X-Account-Bytes-Used: 349 Content-Length: 0