Description
Upload Part - Copy request copies a segment of an object from the source path to the target path. Specify the source object with x-cos-copy-source, and the byte range with x-cos-copy-source-range (allowable chunk size is 5MB - 5GB).
Note:
- If the target object and source object are not in the same region, and the target object's chunk will exceed 5GB, then it's necessary to use the chunked upload or chunked copy interface to copy the object.
- To use upload part object, you must first initialize a chunked upload. In the response of initializing a chunked upload, a unique descriptor (upload ID) will be returned. You need to carry this ID in the chunked upload request.
Version
When bucket version control is enabled, x-cos-copy-source identifies the current version of the object being copied. If the current version is a delete marker, and x-cos-copy-source does not specify a version, then COS will consider the object deleted and return a 404 error. If you specify a versionId in x-cos-copy-source and the versionId is a delete marker, then COS will return an HTTP 400 error, because delete markers are not allowed as versions for x-cos-copy-source.
Request
Request Example
PUT /examplebucket?partNumber=PartNumber&uploadId=UploadId HTTP/1.1
Host: <BucketName-APPID>.<Endpoint>
Date: GMT Date
Authorization: Auth String
x-cos-copy-source: <BucketName-APPID>.<Endpoint>/filepath
x-cos-copy-source-range: bytes=first-last
x-cos-copy-source-if-match: etag
x-cos-copy-source-if-none-match : etag
x-cos-copy-source-if-unmodified-since: time_stamp
x-cos-copy-source-if-modified-since: time_stamp
Request Header
Common Headers
This request operation is implemented using a public request header.
Non-common Headers
Required Headers
This request operation uses the following required headers:
| Name | Description | Type | Required |
|---|---|---|---|
| x-cos-copy-source | The source object URL path, which can specify historical versions with the versionid subresource. | String | Yes |
Recommended headers
This request operation uses the following recommended headers:
| Name | Description | Type | Required |
|---|---|---|---|
| x-cos-copy-source-range | The byte range of the source object, the range value must use the bytes=first-last format, where both first and last are offsets starting from 0. For example, bytes=0-9 means you wish to copy the first 10 bytes of data from the source object. If not specified, it means copying the entire object. |
String | No |
| x-cos-copy-source-If-Modified-Since | If the object is modified after the specified time, the operation will be performed; otherwise, 412 will be returned. This parameter can be used together with x-cos-copy-source-If-None-Match, returns conflict when used in conjunction with other conditions. |
String | No |
| x-cos-copy-source-If-Unmodified-Since | If the object is not modified after the specified time, the operation will be performed; otherwise, 412 will be returned. This parameter can be used with x-cos-copy-source-If-Match, returns conflict when used in conjunction with other conditions. |
String | No |
| x-cos-copy-source-If-Match | If the ETag of the object is the same as the specified one, the operation will be performed; otherwise, 412 will be returned. This parameter can be used with x-cos-copy-source-If-Unmodified-Since, returns conflict when used in conjunction with other conditions. |
String | No |
| x-cos-copy-source-If-None-Match | If the ETag of the object is different from the specified one, the operation will be performed; otherwise, 412 will be returned. This parameter can be used with x-cos-copy-source-If-Modified-Since, returns conflict when used in conjunction with other conditions. |
String | No |
Request Parameters
| Name | Description | Type | Required |
|---|---|---|---|
| partNumber | Part number | String | Yes |
| uploadId | To upload an object in parts, you must first initialize the multipart upload. The response of the multipart upload initialization will carry a unique descriptor (uploadId), which needs to be carried in the multipart upload request. | String | Yes |
Request Body
The request body of this request is empty.
Response
Response Headers
Common Response Headers
This response contains common response headers.
Special Response Headers
| Name | Description | Type |
|---|---|---|
| x-cos-copy-source-version-id | If version control has already been enabled on the source bucket, then the version of the source object will be replicated. | String |
| x-cos-server-side-encryption | If the object is stored with COS-managed server-side encryption, the response will contain this header and the encryption algorithm used (AES256). | String |
Response Body
The response body returns application/xml data. The following contains all the nodes:
<?xml version="1.0" encoding="UTF-8" ?>
<CopyPartResult>
<ETag>"ba82b57cfdfda8bd17ad4e5879ebb4fe"</ETag>
<LastModified>2017-09-04T04:45:45</LastModified>
</CopyPartResult>
The data are as follows:
| Name | Description | Type |
|---|---|---|
| CopyPartResult | Returns the copy result information | String |
| ETag | Returns the MD5 algorithm checksum of the object. The value of ETag can be used to check if the content of the Object has changed. | String |
| LastModified | Last modification time of the object, in GMT format. | String |
Practical Case
Request
PUT /exampleobject?partNumber=1&uploadId=1505706248ca8373f8a5cd52cb129f4bcf85e11dc8833df34f4f5bcc456c99c42cd1ffa2f9 HTTP/1.1
User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
Accept: */*
x-cos-copy-source:<BucketName-APPID>.<Endpoint>/exampleobject1
x-cos-copy-source-range: bytes=10-100
Host: <BucketName-APPID>.<Endpoint>
Authorization:q-sign-algorithm=sha1&q-ak=AKIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&q-sign-time=1507530223;1508530223&q-key-time=1507530223;1508530223&q-header-list=&q-url-param-list=&q-signature=d02640c0821c49293e5c289fa07290e6b2f05cb2
Response
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 133
Connection: keep-alive
Date: Mon, 04 Sep 2017 04:45:45 GMT
x-cos-request-id: NTlkYjFjYWJfMjQ4OGY3MGFfNGIzZV9k
<CopyPartResult>
<ETag>"ba82b57cfdfda8bd17ad4e5879ebb4fe"</ETag>
<LastModified>2017-09-04T04:45:45</LastModified>
</CopyPartResult>