Swift create a container
To create a new container, make a PUT request with the API version, account, and
the name of the new container. The container name must be unique, must not contain a forward-slash
(/) character, and should be less than 256 bytes. You can include access control headers and
metadata headers in the request. You can also include a storage policy identifying a key for a set
of placement pools. For example, run radosgw-admin zone get to see a list of
available keys under placement_pools. A storage policy enables you to specify a
special set of pools for the container, for example, SSD-based storage. The operation is idempotent.
If you make a request to create a container that already exists, it will return with a HTTP 202
return code, but will not create another container.
Syntax
PUT /_AP_VERSION_/_ACCOUNT_/_TENANT_:_CONTAINER_ HTTP/1.1
Host: FULLY_QUALIFIED_DOMAIN_NAME
X-Auth-Token: _AUTH_TOKEN_
X-Container-Read: _COMMA_SEPARATED_UIDS_
X-Container-Write: _COMMA_SEPARATED_UIDS_
X-Container-Meta-_KEY_:VALUE
X-Storage-Policy: _PLACEMENT_POOLS_KEY_
Headers
X-Container-Read
- Description
-
The user IDs with read permissions for the container.
- Type
-
Comma-separated string values of user IDs.
- Required
-
No
X-Container-Write
- Description
-
The user IDs with write permissions for the container.
- Type
-
Comma-separated string values of user IDs.
- Required
-
No
X-Container-Meta-_KEY
- Description
-
A user-defined metadata key that takes an arbitrary string value.
- Type
-
String
- Required
-
No
X-Storage-Policy
- Description
-
The key that identifies the storage policy under
placement_poolsfor the Ceph Object Gateway. Runradosgw-admin zone getfor available keys. - Type
-
String
- Required
-
No
If a container with the same name already exists, and the user is the container owner then the operation will succeed. Otherwise, the operation will fail.
HTTP Response
409
- Status Code
-
BucketAlreadyExists - Description
-
The container already exists under a different user’s ownership.