Method | URI | Description |
---|---|---|
POST | /v1/{account}/{container}/{object} | Creates or updates object metadata. |
To create or update custom metadata, use the
X-Object-Meta-{name}
header, where
{name}
is the name of the metadata
item.
In addition to the custom metadata, you can also
update these system metadata items:
Content-Type
Content-Encoiding
Content-Disposition
X-Delete-At
. However you cannot update
other system metadata such as
Content-Length
or
Last-Modified
.
You can use COPY as an alternate to the POST operation by copying to the same object. With the POST operation you must specify all metadata items, whereas with the COPY operation, you need to specify only changed or additional items.
All metadata is preserved during the object copy. If you specify metadata on the request to copy the object, either PUT or COPY, the metadata overwrites any conflicting keys on the target (new) object.
A POST request deletes any existing custom metadata that you added with a previous PUT or POST request. Consequently, you must specify all custom metadata in the request. However, system metadata is unchanged by the POST request unless you explicitly supply it in a request header.
You can also set the X-Delete-At
or
X-Delete-After
header to define when
to expire the object.
When used as described in this section, the POST operation creates or replaces metadata. This form of the operation has no request body. The form POST feature can also use the POST operation to upload objects. For more information about form POST see OpenStack Object Storage API v1 Reference .
Example requests and responses:
Create object metadata:
curl -i $publicURL/marktwain/goodbye -X POST -H "X-Auth-Token: $token" -H "X-Object-Meta-Book: GoodbyeColumbus"
HTTP/1.1 202 Accepted Content-Length: 76 Content-Type: text/html; charset=UTF-8 X-Trans-Id: txb5fb5c91ba1f4f37bb648-0052d84b3f Date: Thu, 16 Jan 2014 21:12:31 GMT <html><h1>Accepted</h1><p>The request is accepted for processing.</p></html>
Update object metadata:
curl -i $publicURL/marktwain/goodbye -X POST -H "X-Auth-Token: $token" -H "X-Object-Meta-Book: GoodbyeOldFriend"
HTTP/1.1 202 Accepted Content-Length: 76 Content-Type: text/html; charset=UTF-8 X-Trans-Id: tx5ec7ab81cdb34ced887c8-0052d84ca4 Date: Thu, 16 Jan 2014 21:18:28 GMT <html><h1>Accepted</h1><p>The request is accepted for processing.</p></html>
For a complete description of HTTP 1.1 header definitions, see Header Field Definitions.
Normal response codes: 202
This table shows the header parameters for the create or update object metadata request:
Name | Type | Description |
---|---|---|
| String (Optional) | Authentication token. If you omit this header, your request fails unless the account owner has granted you access through an access control list (ACL). |
| String (Optional) | The container metadata, where You must specify a |
| Int (Optional) | The certain date, in the format of a UNIX Epoch timestamp, when the object is removed. |
| String (Optional) | If set, specifies the override behavior for the browser. For example, this header might specify that the browser use a download program to save this file rather than show the file, which is the default. |
| String (Optional) | If set, the value of the
|
| Int (Optional) | Specifies the number of seconds after which the
object is removed. Internally, the Object Storage system
stores this value in the |
| String (Optional) | Changes the MIME type for the object. |
| Boolean (Optional) | If set to |
This table shows the URI parameters for the create or update object metadata request:
Name | Type | Description |
---|---|---|
| String | The unique name for the account. An account is also known as the project or tenant. |
| String | The unique name for the container. |
| String | The unique name for the object. |
This table shows the header parameters for the create or update object metadata response:
Name | Type | Description |
---|---|---|
| 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. |
| String (Required) | The MIME type of the object. |
| Uuid (Required) | A unique transaction identifier for this request. Your service provider might need this value if you report a problem. |
| Datetime (Required) | The transaction date and time. |