• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (Swift)
  4. Operations on Containers
  5. Create Container
  6. Request

Request

Method

Table 1 Method description

Method

URI

Description

PUT

/v1/{account}/{container}

Creates a container in a specified account.

{account} indicates the name of an account.

{container} indicates the name of a container.

This operation does not involve a request body.

Example Request

Create a container named marktwain:

curl -i $publicURL/marktwain -X PUT -H "X-Auth-Token:$token"

Request Query Parameters

This operation does not include request query parameters.

Request Headers

Request URI parameters

Parameter

Type

Description

{account}

String

(Required)

Unique name of the account. In the current version, it indicates the unique ID of the account.

{container}

String

(Required)

Unique name of the container.

For details about container naming rules, see Naming Rules.

Table 2 describes the request header parameters.

Table 2 Request header parameters

Header

Type

Description

X-Auth-Token

String

(Required)

Authentication token.

X-Container-Read

String

(Optional)

Sets a container access control list (ACL) that grants read access.

To set the container read ACL:

curl -X {PUT|POST} -i -H "X-Auth-Token: $token" -H \

"X-Container-Read: ACL" $publicURL/Container

For details about ACL format rules, see the next section.

X-Container-Write

String

(Optional)

Sets a container ACL that grants write access.

To set the container write ACL:

curl -X {PUT|POST} -i -H "X-Auth-Token: $token" -H \

"X-Container-Write: ACL" $publicURL/Container

For details about ACL format rules, see the next section.

X-Container-Meta-name

String

(Optional)

Container metadata. {name} is the name of metadata item that you want to add, update, or delete. To delete this item, send an empty value in this header. You must specify an X-Container-Meta-{name} header for each metadata item (for each {name}) that you want to add, update, or delete.

Container Read ACL Rules (X-Container-Read)

Container read ACL rules are as follows:

  • .r:*#: All referrers.
  • .r:example.com,swift.example.com#: Comma-separated list of referrers.
  • .rlistings#: Container listing access, always combined with .r:.
  • .r:-example.com#: Comma-separated list of inaccessible addresses.
  • {account:user} #: account is projectid and user is userid.

Container Write ACL Rules (X-Container-Write)

Container write ACL rules are as follows:

  • {account:user} #: Only this format is supported. account is projectid and user is userid.