Create container

 
MethodURIDescription
PUT/v1/{account}/{container}

Creates a container.

You do not need to check if a container already exists before issuing a PUT operation because the operation is idempotent: It creates a container or updates an existing container, as appropriate.

Example requests and responses:

  • Create a container with no metadata: curl -i $publicURL/steven -X PUT -H "Content-Length: 0" -H "X-Auth-Token: $token"

    HTTP/1.1 201 Created
    Content-Length: 0
    Content-Type: text/html; charset=UTF-8
    X-Trans-Id: tx7f6b7fa09bc2443a94df0-0052d58b56
    Date: Tue, 14 Jan 2014 19:09:10 GMT

  • Create a container with metadata:

    curl -i $publicURL/marktwain -X PUT -H "X-Auth-Token: $token" -H "X-Container-Meta-Book: TomSawyer"

    HTTP/1.1 201 Created
    Content-Length: 0
    Content-Type: text/html; charset=UTF-8
    X-Trans-Id: tx06021f10fc8642b2901e7-0052d58f37
    Date: Tue, 14 Jan 2014 19:25:43 GMT

For a complete description of HTTP 1.1 header definitions, see Header Field Definitions.

Normal response codes: 201, 204

 Request

This table shows the header parameters for the create container request:

NameTypeDescription

X-Auth-Token

​String

(Required)

Authentication token.

X-Container-Read

​String

(Optional)

Sets an ACL that grants read access.

X-Container-Write

​String

(Optional)

Sets an ACL that grants write access.

X-Container-Sync-To

​String

(Optional)

Sets the destination for container synchronization.

X-Container-Sync-Key

​String

(Optional)

Sets the secret key for container synchronization.

X-Versions-Location

​String

(Optional)

Enables versioning on this container. The value is the name of another container. You must UTF-8-encode and then URL-encode the name before you include it in the header. To disable versioning, set the header to an empty string.

X-Container-Meta-name

​String

(Optional)

The container metadata, where {name} is the name of metadata item.

You must specify a X-Container-Meta-{name} header for each metadata item (for each {name}) that you want to add or update.

Content-Type

​String

(Optional)

Changes the MIME type for the object.

X-Detect-Content-Type

​Boolean

(Optional)

If set to true, Object Storage guesses the content type based on the file extension and ignores the value sent in the Content-Type header, if present.

This table shows the URI parameters for the create container request:

NameTypeDescription

{account}

​String

The unique name for the account. An account is also known as the project or tenant.

{container}

​String

The unique name for the container.

 Response

This table shows the header parameters for the create container response:

NameTypeDescription

Content-Length

​String

(Required)

If the operation succeeds, this value is zero (0). If the operation fails, this value is the length of the error text in the response body.

Content-Type

​String

(Required)

If the operation fails, this value is the MIME type of the error text in the response body.

X-Trans-Id

​Uuid

(Required)

A unique transaction identifier for this request. Your service provider might need this value if you report a problem.

Date

​Datetime

(Required)

The transaction date and time.

Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page

loading table of contents...