An object represents the data and any metadata for the files stored in the system. Through the REST interface, metadata for an object can be included by adding custom HTTP headers to the request and the data payload as the request body. Objects name should not exceed 1024 bytes after URL encoding.
This section describes the list of operations you can perform at the object level of the URL.
You can use
PUT command to write or update an object's content and metadata.
You can verify the data integrity by including an MD5 checksum for the object's data in the ETag header. ETag header is optional and can be used to ensure that the object's contents are stored successfully in the storage system.
You can assign custom metadata to objects by including additional HTTP headers on the
PUT request. The objects created with custom metadata via HTTP headers are identified with the X-Object-Meta-prefix.
- To create or update an object, run the following command:
PUT /<apiversion>/<account>/<container>/<object> HTTP/1.1 Host: <storage URL> X-Auth-Token: <authentication-token-key> ETag: da1e100dc9e7becc810986e37875ae38 Content-Length: 342909 X-Object-Meta-PIN: 2343
For example,PUT /v1/AUTH_test/pictures/dog HTTP/1.1 Host: example.storage.com X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554 ETag: da1e100dc9e7becc810986e37875ae38 HTTP/1.1 201 Created Date: Wed, 13 Jul 2011 18:32:21 GMT Server: Apache ETag: da1e100dc9e7becc810986e37875ae38 Content-Length: 0 Content-Type: text/plain; charset=UTF-8
To create or update an object using cURL (for the above example), run the following command:curl -v -X PUT -H 'X-Auth-Token: AUTH_tkde3ad38b087b49bbbac0494f7600a554' https://example.storage.com:443/v1/AUTH_test/pictures/dog -H 'Content- Length: 0' -k
The status code of 201 (Created) indicates that you have successfully created or updated the object. If there is a missing content-Length or Content-Type header in the request, the status code of 412 (Length Required) is displayed. (Optionally) If the MD5 checksum of the data written to the storage system does not match the ETag value, the status code of 422 (Unprocessable Entity) is displayed.
You can upload data without knowing the size of the data to be uploaded. You can do this by specifying an HTTP header of Transfer-Encoding: chunked and without using a Content-Length header.
You can use this feature while doing a DB dump, piping the output through gzip, and then piping the data directly into Object Storage without having to buffer the data to disk to compute the file size.
- To create or update an object, run the following command:
PUT /<apiversion>/<account>/<container>/<object> HTTP/1.1 Host: <storage URL> X-Auth-Token: <authentication-token-key> Transfer-Encoding: chunked X-Object-Meta-PIN: 2343
For example,PUT /v1/AUTH_test/pictures/cat HTTP/1.1 Host: example.storage.com X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554 Transfer-Encoding: chunked X-Object-Meta-PIN: 2343 19 A bunch of data broken up D into chunks. 0