All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Upload Part Copy

Last updated:2021-09-18 10:58:42

Description

This operation can upload a block by copying existing objects. The user specifies the data source by configuring the request header x-kss-copy-source in the request, and the byte range by the request header x-kss-copy-source-range.
Attention In addition, you can also upload blocks by including data in the request. For more information, please check the interface Upload Part

Before you upload any block, you must start a block upload task. After you send a startup request, KS3 will give you a unique upload ID. Each time you upload a block, you need to include the upload ID in the request.

The number of blocks can be any one of 1 to 10000 inclusive. Block ordinal is used to identify a block and its location at the time of object creation. If you upload a new block and use the previously used serial number, the previous block will be overwritten. Except that the last block has no size limit, the size of other blocks is required to be more than 5MB.

Request

Syntax

PUT /{ObjectName}?partNumber={PartNumber}&uploadId={UploadId} HTTP/1.1
Host: {BucketName}.{endpoint}
x-kss-copy-source: {/source_bucket/sourceObject}
x-kss-copy-source-range:bytes={first}-{last}
x-kss-copy-source-if-match: {etag}
x-kss-copy-source-if-none-match: {etag}
x-kss-copy-source-if-unmodified-since: {time_stamp}
x-kss-copy-source-if-modified-since: {time_stamp}
Date: {date}
Authorization: {SignatureValue}

Attention:

Request Parameters

The request does not use the request parameter.

Request Headers

The interface can use all common request headers. For more information, please click Public Request Headers.

Name Description Required
x-kss-copy-source The combination of the space name and the object key name of the object is separated by a slash ('/').
Type: String
Default: None
Yes
x-kss-copy-source-range The range of bytes copied from the data source. Range setting must use bytes=first-last. Its value is based on 0. For example: bytes=0-9 means that the user will copy the first 10 bytes. This header is not required when copying the entire object.
Type: Integer
Default: None
No

The headers listed in the following table are based on the specified x-kss-copy-source header

Name Description Required
x-kss-copy-source-if-match If the ETag(entity tag) of object is consistent with the specified value, copy object. Otherwise, 412 status code is returned
Type:String
Default:None
Constraints:None
No
x-kss-copy-source-if-none-match If the ETag(entity tag) of object is inconsistent with the specified value, copy object. Otherwise, 304 status code is returned
Type:String
Default:None
Constraints:None
No
x-kss-copy-source-if-unmodified-since If the object is not changed after the specified time, copy the object. Otherwise, 412 status code is returned
Type:String
Default:None
Constraints:None
No
x-kss-copy-source-if-modified-since If the object is changed after a specified time, copy the object. Otherwise, 304 status code is returned
Type:String
Default:None
Constraints:None
No
If server encryption is required, the following headers are required
Name Description Required
x-kss-server-side-encryption-customer-key The base64-encoded encryption key used by KS3 encryption is specified by the user.
Type:String
Constraint: required and valid x-kss-server-side-encryption-customer-algorithm,x-kss-server-side-encryption-customer-key-MD5 are used at the same time
Yes
x-kss-server-side-encryption-customer-algorithm If the server uses the encryption key provided by the user for encryption, the response will include the header to confirm the decryption algorithm used when the request is decrypted.
Type:String
Valid Value:AES256
Constraint: required and valid x-kss-server-side-encryption-customer-key,x-kss-server-side-encryption-customer-key-MD5 are used at the same time
Yes
x-kss-server-side-encryption-customer-key-MD5 If the server uses the encryption key provided by the user for encryption, the response will include the header to provide the data consistency verification information of the encryption key provided by the user when the request is decrypted.
Type:String
Constraint: required and valid x-kss-server-side-encryption-customer-key,x-kss-server-side-encryption-customer-algorithmare used at the same time
Yes

If the object as the data source uses the user's secret key for server encryption, the user needs to use the following header to enable KS3 to decrypt the object.

Name Description Required
x-kss-copy-source-server-side-encryption-customer-key The base64-encoded encryption key used by KS3 encryption is specified by the user.
Type:String
Constraint: required and valid x-kss-server-side-encryption-customer-algorithm,x-kss-server-side-encryption-customer-key-MD5 are used at the same time
Yes
x-kss-copy-source-server-side-encryption-customer-algorithm If the server uses the encryption key provided by the user for encryption, the response will include the header to confirm the decryption algorithm used when the request is decrypted.
Type:String
Valid Value:AES256
Constraint: required and valid x-kss-server-side-encryption-customer-key,x-kss-server-side-encryption-customer-key-MD5 are used at the same time
Yes
x-kss-copy-source-server-side-encryption-customer-key-MD5 If the server uses the encryption key provided by the user for encryption, the response will include the header to provide the data consistency verification information of the encryption key provided by the user when the request is decrypted.
Type:String
Constraint: required and valid x-kss-server-side-encryption-customer-key,x-kss-server-side-encryption-customer-algorithmare used at the same time
Yes

Request Elements

The interface does not use the requested content.

Response

Response Headers

This interface can use all common response headers. For more information, please click Public Response Headers.

Name Description
x-kss-server-side-encryption If server-side encryption is used to store object, the response will contain the header, and the value is the encryption algorithm used.
Type:String
x-kss-server-side-encryption-customer-algorithm If the server uses the encryption key provided by the user for encryption, the response will include the header to confirm the decryption algorithm used when the request is decrypted.
Type:String
Valid Value:AES256
x-kss-server-side-encryption-customer-key-MD5 If the server uses the encryption key provided by the user for encryption, the response will include the header to provide the data consistency verification information of the encryption key provided by the user when the request is decrypted.
Type:String

Response Elements

Name Description
CopyPartResult Container for the response content.
Type: Container
Ancestors: None
ETag Returns the entity label of a new block.
Type: String
Ancestors: CopyPartResult
LastModified Returns the last modified time and date.
Type: String
Ancestors: CopyPartResult

Specail Errors

Error Code Description HTTP Status Code
NoSuchUpload The specified chunk upload task does not exist. It may be that the upload ID is invalid, or the block upload task has been completed or abandoned. 404 Not Found
InvalidRequest The specified data source object does not support copying by byte range. 400 Bad Request

Examples

Sample Request

PUT /new-video.rm?partNumber=2 &uploadId=6aaf37c7501847569c91f9957b01fd14 HTTP/1.1
Host: ks3-example.ks3-cn-beijing.ksyuncs.com
Date: Mon, 11 Apr 2011 20:34:56 GMT
x-kss-copy-source: /source-bucket/sourceobject
x-kss-copy-source-range:bytes=500-6291456
Authorization: authorization string

Sample Response

HTTP/1.1 200 OK
Date: Mon, 11 Apr 2011 20:34:56 GMT
Server: Tengine

<CopyPartResult>
<LastModified>2009-10-28T22:32:00</LastModified>
<ETag>"9b2cf535f27731c974343645a3985328"</ETag>
</CopyPartResult>
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback