• Object Storage Service

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

Request

Method

Table 1 Method description

Method

URI

Description

POST

/v1/{account}/{container}/{object}

Creates, updates, or deletes object metadata.

{account} indicates the name of an account.

{container} indicates the name of a container.

{object} indicates the name of an object.

A POST request deletes all existing user metadata.

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/goodbye  -X POST -H "X-Auth-Token:$token" -H "X-Object-Meta-name:value"

Delete metadata:

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

Request Query Parameters

This request does not include 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.

{object}

String

(Required)

Name of the object.

For details about object naming rules, see Object Naming Rules.

Table 2 Request header parameters

Header

Type

Description

X-Auth-Token

String

(Required)

Authentication token. If you omit this header, your request fails unless the account owner has granted you access through an ACL.

X-Object-Meta-name

String

(Optional)

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

Content-Type

String

(Optional)

Sets the MIME type of the object.

X-Detect-Content-Type

Boolean

(Optional)

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

Content-Length

String

(Optional)

Set to the length of the object content. Do not set if chunked transfer encoding is being used.

Content-Disposition

String

(Optional)

When the header is set to {newname} and an object is downloaded through a browser, the default object name {newname} is returned.

Content-Encoding

String

(Optional)

If this header is set, the value is the encoding format used when an object is downloaded through a browser.