< Previous | Contents | Next >

Storing an object

You use the HTTP PUT method to store an object in a bucket. To store an object, you need write permission for the bucket.


For a request to store an object, the request body consists of the data in a specified file. This data becomes the object content.


When you store an object, you specify a name for it. The object name does not need to be the same as the name of the file containing the original data. For information on naming objects, see “Object names” on page 16.


If versioning is enabled and you try to store an object with the same name as an existing object, HCP creates a new version of the object. If versioning is disabled and you try to store an object with the same name as an existing object, HCP returns a 409 (Conflict) status code and does not store the object. For information on versioning, see “Versioning” on page 34.


You can add custom metadata to an object in the same request as you use to store the object. To do this, you use x-amz-meta- headers. For information on custom metadata, see “Custom metadata” on page 20.


You can specify an ACL for an object in the same request as you use to store the object. To do this, you need to use ACL headers. You cannot use an ACL request body when storing an object. For information on ACLs, see “Access control lists” on page 25.


If the ACL you specify in a request to store an object is invalid, HCP returns a 400 (Bad Request) or 501 (Not Implemented) status code and does not store the object.


If you’re an authenticated user, when you store an object, you become the object owner. If you’re accessing the bucket anonymously, the new object has no owner. For information on object ownership, see “Object owners” on page 24.


 

ETagsEnsuring object integrityObject encryptionSaving network bandwidthRequest headersResponse headersHTTP status codesExamplesExample 1: Storing an objectExample 2: Storing an object with custom metadata and an ACL