Storing an object

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

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 about naming objects, see Object names.

If versioning is enabled and you try to store an object with the same name as an existing object, HCP stores both versions of the object, but HSwift can only access the newest version. 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 versioning, see Versioning.

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-Object-Meta- headers. For information about custom metadata, see Custom metadata.

ETags

When you store an object, HCP returns the ETag for the object in the ETag response header. An ETag is an identifier for the content of an object. ETags are useful for making object-level operations conditional based on the object content. Operations that can be made conditional are storing an object, checking the existence of an object, copying an object, and retrieving an object.

Ensuring object integrity

When you store an object, you can use the ETag request header to ensure the integrity of the object data. The value you specify for this header must be the Base 64-encoded MD5 hash of the original file data.

When you include the ETag header in a request to store an object, HCP calculates the Base64-encoded MD5 hash of the data it receives and compares that to the header value. If the values don't match, HCP returns a 422 (Unprocessable Entity) status code and does not store the object.

Saving network bandwidth

You can use the Expect request header in a request to store an object to tell the application not to send the request body (the data) to HCP if the request headers are rejected. This prevents unnecessary network bandwidth usage.

Storing large objects

HCP does not provide support for Swift large objects. Instead, to facilitate storing large objects, you can use the S3 compatible API. With the S3 compatible API, you can break the data for an object into multiple parts and upload the parts to HCP individually. The process of creating an object by uploading the data in parts is called multipart upload. The result of a multipart upload is a single object that behaves in the same way as objects for which all the data was stored by means of a single PUT object request.

For more information about multipart uploads, see Working with multipart uploads.

© 2015, 2020 Hitachi Vantara LLC. All rights reserved.