Create, update, or delete container metadata

 
MethodURIDescription
POST/v1/{account}/{container}

Creates, updates, or deletes custom metadata for a container.

To create, update, or delete a custom metadata item, use the X-Container-Meta-{name} header, where {name} is the name of the metadata item.

Subsequent requests for the same key and value pair overwrite the previous value.

To delete container metadata, send an empty value for that header, such as for the X-Container-Meta-Book header. If the tool you use to communicate with Object Storage, such as an older version of cURL, does not support empty headers, send the X-Remove-Container-Meta-{name}: arbitrary value header. For example, X-Remove-Container-Meta-Book: x. The operation ignores the arbitrary value.

If the container already has other custom metadata items, a request to create, update, or delete metadata does not affect those items.

This operation does not accept a request body.

Example requests and responses:

  • Create container metadata:

    curl -i $publicURL/marktwain -X POST -H "X-Auth-Token: $token" -H "X-Container-Meta-Author: MarkTwain" -H "X-Container-Meta-Century: Nineteenth"

    HTTP/1.1 204 No Content
    Content-Length: 0
    Content-Type: text/html; charset=UTF-8
    X-Trans-Id: tx05dbd434c651429193139-0052d82635
    Date: Thu, 16 Jan 2014 18:34:29 GMT

  • Update container metadata:

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

    HTTP/1.1 204 No Content
    Content-Length: 0
    Content-Type: text/html; charset=UTF-8
    X-Trans-Id: txe60c7314bf614bb39dfe4-0052d82653
    Date: Thu, 16 Jan 2014 18:34:59 GMT

  • Delete container metadata:

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

    HTTP/1.1 204 No Content
    Content-Length: 0
    Content-Type: text/html; charset=UTF-8
    X-Trans-Id: tx7997e18da2a34a9e84ceb-0052d826d0
    Date: Thu, 16 Jan 2014 18:37:04 GMT

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

If the request succeeds, the operation returns the 204 status code.

To confirm your changes, issue a show container metadata request.

Normal response codes: 204

 Request

This table shows the header parameters for the create, update, or delete container metadata request:

NameTypeDescription

X-Auth-Token

​String

(Required)

Authentication token.

X-Container-Read

​String

(Optional)

Sets an ACL that grants read access.

X-Remove-Container-name

​String

(Optional)

Removes the metadata item named {name}. For example, X-Remove-Container-Read removes the X-Container-Read metadata item.

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-Remove-Versions-Location

​String

(Optional)

Set to any value to disable versioning.

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, update, or delete container metadata 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, update, or delete container metadata 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...