Completing a multipart upload

You use the HTTP POST method with the uploadId query parameter to complete a multipart upload.

To complete a multipart upload, you must be an authenticated user. You need to use the same user account as the account used in the request to initiate the multipart upload. Additionally, you need write permission for the bucket where the multipart upload was initiated.

You use the uploadId query parameter to specify the upload ID of the multipart upload you are completing. If the upload ID you specify does not match the upload ID of an in-progress multipart upload or is not associated with the object specified in the request, the upload does not complete and HCP returns a 404 (Not Found) status code.

To specify the list of parts to use when completing a multipart upload, you use an XML request body . You identify each part by its part number and the ETag returned when the part was uploaded. The list of parts must be in ascending order by part number.

Only the parts listed in the request to complete a multipart upload are used as data for the resulting object. Parts that were uploaded for the multipart upload but that are not listed in the request are automatically deleted after the request is processed.

A multipart upload must have at least one part to complete.

When you complete a multipart upload, you become the owner of the resulting object.

If a request to complete a multipart upload includes any custom metadata (x-amz-meta-) headers, HCP returns a 400 (Bad Request) status code and does not complete the multipart upload.

HCP ignores ACL headers in requests to complete a multipart upload.

Conditionally completing a multipart upload

If versioning is enabled for a bucket, you can use a multipart upload to create a new version of an object in the bucket. However, between the time you initiated the multipart upload and the time and the time the upload completes, another user might have stored a different new version of the object (by using either a single PUT object request or a multipart upload).

To ensure that the version of the object is the most recent one for which you initiated the request, include the If-Match header in the request to complete the multipart upload. If the value you specify for the If-Match header matches the ETag of the most recent version of the object, HCP completes the multipart upload. If the value does not match the ETag or the object does not exist, HCP returns an error response body and does not complete the upload.

Note: The If-Match header is not part of the Amazon S3 API.

Complete multipart upload request result

Processing a request to complete a multipart upload can take several minutes. When processing starts, HCP returns a 200 (OK) status code. While processing continues, HCP periodically sends white-space characters to prevent the connection from timing out.

If a request to complete a multipart upload succeeds, the response body contains information about the resulting object. If the request fails, the response body contains error information. To determine the outcome of amultipart upload request, you need to check the content of the response body in addition to the status code.

The following errors can cause a request to complete a multipart upload to fail after HCP returns the 200 (OK) status code:

The list of parts in the request body includes a part, other than the last part, that is smaller than one megabyte.

The list of parts in the request body includes one or more part numbers that are not the number of an uploaded part.

The ETag associated with one or more part numbers listed in the request body is not the ETag returned for the part with the specified part number.

The parts in the request body are not listed in ascending order.

The request includes the If-Match request header and either the value specified by the header does not match the ETag of the most recent version of the specified object, or the specified object does not already exist.

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