- 4.2.9.1. Large Object Creation
- 4.2.9.2. Chunked Transfer Encoding
- 4.2.9.3. Bulk Importing Data
- 4.2.9.4. Assigning CORS Headers to Requests
- 4.2.9.5. Enabling File Compression with the Content-Encoding Header
- 4.2.9.6. Enabling Browser Bypass with the Content-Disposition Header
- 4.2.9.7. Expiring Objects with the X-Delete-After and X-Delete-At Headers
- 4.2.9.8. Object Versioning
PUT operations are used to write, or overwrite, an object's content and metadata.
You can ensure end-to-end data integrity by including an MD5 checksum of your object's data in the ETag header. You are not required to include the ETag header, but it is recommended to ensure that the storage system successfully stored your object's content.
You can cause an object to expire after a certain date by
using the X-Delete-At or
X-Delete-After headers during an object PUT
operation. When Cloud Files detects one of these headers,
the system automatically stops serving that object at the
specified time and shortly after the expiration date, it
removes the object from the storage system.
The HTTP response will include the MD5 checksum of the data written to the storage system. If you do not send the ETag in the request, you should compare the value returned with your content's MD5 locally to perform the end-to-end data validation on the client side. For segmented objects, the ETag is the MD5 sum of the concatenated string of ETags for each of the segments in the manifest, which only offers change detection but not direct comparison.
Objects can be assigned custom metadata by including additional HTTP headers on the PUT request.
The object can be created with custom metadata via HTTP headers identified with the
X-Object-Meta- prefix.
Example 4.36. Create/Update Object Request
PUT /<api version>/<account>/<container>/<object> HTTP/1.1
Host: storage.clouddrive.com
X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb
ETag: 8a964ee2a5e88be344f36c22562a6486
Content-Length: 512000
X-Object-Meta-PIN: 1234
[ ... ]
No response body is returned. A status code of 201
(Created) indicates a successful write.
Any status in the 400 range denotes failure:
401 (Unauthorized) is returned upon authentication failure,
411 (Length
Required) denotes a missing Content-Length or
Content-Type header in the request. If the
MD5 checksum of the data written to the storage system does
NOT match the (optionally) supplied ETag value, a 422
(Unprocessable Entity) response is returned, etc.
Example 4.37. Create/Update Object Response
HTTP/1.1 201 Created
Date: Thu, 07 Jun 2007 18:57:07 GMT
ETag: d9f5eb4bba4e2f2f046e54611bc8196b
Content-Length: 0
Content-Type: text/plain; charset=UTF-8

