Swift
With the Swift API (an API based on the OpenStack Object Storage API), you can work with S3 resources:
- view information about the number and volume of buckets and objects within the account;
- to create and remove baquettes;
- manage buckets limits;
- upload, view, copy, move, download, and delete objects in the bucket.
To access the Swift API, the user must have a role with access to the project in S3, more details in the documentation instructions Manage Access in S3.
Authorization
Authorization in the Swift API is done using the IAM token for the project, which is passed in each request in the X-Auth-Token
header.
The address (URL) can be viewed in the URL list.
An example query to view the list of bucket list in an account project:
curl -i \
-H 'X-Auth-Token: <x_auth_token>' \
'https://<swift_domain>/v1/<project_id>'
Specify:
<x_auth_token>
— IAM token for the project;<swift_domain>
— Swift API domain в pool where S3 is located;<project_id>
— project identifier. You can view the ID in control panel under S3 → project menu → Project Management. The identifier is listed under the project name.
Storage
Get storage information
Returns metadata with information about the number and storage capacity of bins and objects.
Example request
curl -i \
-H 'X-Auth-Token: <x_auth_token>' \
'https://<swift_domain>/v1/<project_id>'
Example answer
If successful, the request returns a response with code 204.
HTTP/1.1 204 No Content
Content-Length: 0
X-Account-Object-Count: 6
X-Timestamp: 1374058535.42927
X-Account-Meta-Temp-Url-Key: 00000
X-Account-Bytes-Used: 484474
X-Account-Container-Count: 3
X-Account-Meta-<...>: anyheader
X-Openstack-Requiest-Id: 0009ec57-2681-4b48-9105-71c57016edc6
X-Trans-Id: 0009ec57-2681-4b48-9105-71c57016edc6
Response Parameters
Get information about the storage and the list of bucket list
Returns storage information and a list of bucket list.
One query outputs a list that can contain up to 10,000 bucket list. If there are more bucket list, use additional queries with query-parameter marker
.
To get more information about bucket (size, update date, etc.), use the query parameter? format=json
.
Example request
curl \
-H 'X-Auth-Token: <x_auth_token>' \
'https://<swift_domain>/v1/<project_id>'
Example answer
bucket1
bucket2
bucket3
Manage storage metadata
Sets, replaces, or removes the metadata passed in the header from the request.