• Object Storage Service

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

Request

Method

Table 1 Method description

Method

URI

Description

POST

/v1/{account}/{container}

Creates, updates, or deletes container metadata.

{account} indicates the name of an account. {container} indicates the name of a container.

Metadata creation or update depends on whether the specified metadata exists. Metadata is created if it does not exist. Metadata is updated if it exists.

This operation does not involve a request body.

Example Request

Create or update metadata:

curl -i $publicURL/marktwain -X POST -H "X-Auth-Token:$token" -H "X-Container-Meta-name:value"

Delete metadata:

curl -i $publicURL/marktwain -X POST -H "X-Auth-Token:$token" -H "X-Remove-Container-Meta-name:x"

Request Query Parameters

Parameter

Type

Description

bulk-delete

String

(Optional)

Bulk-deletes objects. This parameter is used with the deletion list file.

A maximum of 10,000 objects can be deleted.

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 ACL that grants read access. For details about the ACL rules, see Container Read ACL Rules (X-Container-Read).

X-Container-Write

String

(Optional)

Sets a container ACL that grants write access. For details about the ACL rules, see Container Write ACL Rules (X-Container-Write).

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.

X-Remove-Container-Meta-name

String

(Optional)

Deletes container metadata. {name} is the name of metadata item that you want to add, update, or delete. Metadata deletion requires the X-Remove-Container-Meta-{name} parameter, and the value can be set to any non-empty character string.

X-Container-Meta-Web-Directory-Type

String

(Optional)

Type of the object shown as a folder.

X-Container-Meta-Web-Index

String

(Optional)

Name of the specified index page.

X-Container-Meta-Web-Error

String

(Optional)

Name of the page shown in the error information, only 401 and 404 errors supported.

X-Container-Meta-Web-Listings

boolean

(Optional)

Indicates whether to show the object list when no index page is configured. The value true indicates to show and false (default) not to show.

X-Container-Meta-Web-Listings-CSS

String

(Optional)

Type of the CSS loaded when showing the object list.

X-Web-Mode

boolean

(Optional)

Indicates whether to enable static website for authorized users. The value true indicates to enable and false (default) not to enable.

X-Container-Meta-Access-Control-Allow-Origin

String

(Optional)

Website addresses whose CORS-based access requests are allowed, which are separated from each other with commas (,).

X-Container-Meta-Access-Control-Max-Age

Int

(Optional)

Maximum duration during which clients can keep CORS access results (clients' browsers cache CORS access results).

X-Container-Meta-Access-Control-Expose-Headers

String

(Optional)

Headers that can be exposed to clients (for example browsers), separated from each other with spaces.

X-Container-Meta-Temp-URL-Key

String

(Optional)

Secret key value for container-layer TempURL.

X-Container-Meta-Temp-URL-Key-2

String

(Optional)

A second secret key value for container-layer TempURL.