copyPart method
Copies part of an object.
It provides the same functionality as uploadPart method, but data is copied from an existing object rather than transmitted in the request body.
Request
PUT /{bucket}/{key}?partNumber=PartNumber&uploadId=UploadId HTTP/2
Path parameters
Parameter | Description |
---|---|
bucket |
Name of the resulting bucket. |
key |
Key of the resulting object. ID that the object is saved with in Object Storage. |
Query parameters
Parameter | Description |
---|---|
partNumber |
ID that you assigned to the uploaded part. |
uploadId |
ID of the multipart upload returned by Object Storage at startup. |
Headers
Use the necessary common request headers in requests.
The Content-Length
header is required. The headers listed in the table below are also required.
Header | Description |
---|---|
X-Amz-Copy-Source |
The name of the bucket and the key of the object whose data will be copied, separated by the / character.For example, X-Amz-Copy-Source: /source_bucket/sourceObject . |
X-Amz-Copy-Source-Range |
Byte range to copy from the source object. For example, if you specify X-Amz-Copy-Source-Range:bytes=10-36 , then Object Storage will copy the range from the 10th to the 36th bytes of the source object. |
The Content-MD5
header is mandatory if default object locks are set up in the bucket.
If you want to add copy conditions, use the headers listed in the table below.
Use the headers from the table below if you need to change the default behavior of the copy
method.
Header | Description |
---|---|
X-Amz-Copy-Source-If-Match |
Condition for copying an object. If the object's ETag matches the one specified in the header, the object is copied.If the condition is not met, Object Storage returns error 412. Can be used with the X-Amz-Copy-Source-If-Unmodified-Since . |
X-Amz-Copy-Source-If-None-Match |
Condition for copying an object. If the object's ETag does not match the one specified in the header, the object is copied.If the condition is not met, Object Storage returns error 412. Can be used with the X-Amz-Copy-Source-If-Unmodified-Since . |
X-Amz-Copy-Source-If-Unmodified-Since |
Condition for copying an object. The object is copied if it has not been modified since the specified time. If the condition is not met, Object Storage returns error 412. Can be used with the X-Amz-Copy-Source-If-Match . |
X-Amz-Copy-Source-If-Modified-Since |
Condition for copying an object. The object is copied if it has been modified since the specified time. If the condition is not met, Object Storage returns error 412. Can be used with the X-Amz-Copy-Source-If-None-Match . |
Response
Headers
Responses can only contain common response headers.
Response codes
For a list of possible responses, see Responses.
Additionally, Object Storage may return errors described in the table below.
Error | Description | HTTP code |
---|---|---|
NoSuchUpload |
The specified upload doesn't exist. The specified upload ID might be incorrect or the upload was completed or deleted. | 404 Not Found |
EntityTooSmall |
The part is too small. The uploaded part must be at least 5 MB. |
400 Bad Request |
Data schema
<CopyObjectResult>
<LastModified>2019-02-15T14:32:00</LastModified>
<ETag>"9bgh7535f2734ec974343yuc93985328"</ETag>
</CopyObjectResult>
Element | Description |
---|---|
CopyObjectResult |
Contains response elements. Path: /CopyObjectResult . |
ETag |
ETag of the resulting part of multipart upload.Path: /CopyObjectResult/ETag . |
LastModified |
Date when a part of multipart upload was last modified. Path: /CopyObjectResult/LastModified . |