PUT Part - Copy
API Description
After a multipart upload is initialized, you can use this API to copy a part to a specified bucket by using the multipart upload ID.
Method Definition
1. ObsClient->copyPart(array $parameter) 2. ObsClient->copyPartAsync(array $parameter, callable $callback)
Request Parameter
Field | Type | Optional or Mandatory | Description |
|---|---|---|---|
Bucket | string | Mandatory | Bucket name |
Key | string | Mandatory | Object name |
PartNumber | integer | Mandatory | Part number, which ranges from 1 to 10000 |
UploadId | string | Mandatory | Multipart upload ID |
CopySource | string | Mandatory | Parameter used to specify the source bucket, source object, and source object version ID which can be null. It is in the format of SourceBucketName/SourceObjectName?versionId=SourceObjectVersionId. |
CopySourceRange | string | Optional | Copy range of the source object. The value range is [0, source object length-1] and is in the format of bytes=x-y. If the maximum length of CopySourceRange is larger than the length of the source object minus 1, the length of the source object minus 1 is used. |
Returned Result
Field | Type | Description |
|---|---|---|
HttpStatusCode | integer | HTTP status code |
Reason | string | Reason description |
RequestId | string | Request ID returned by the OBS server |
ETag | string | ETag of the target part |
LastModified | string | Time when the last modification was made to the target part |
Sample Code
try { $resp = $obsClient->copyPart( [ 'Bucket' => 'bucketname', 'Key' => 'objectkey', 'UploadId' => 'uploadid', 'PartNumber' => 1, 'CopySource' => 'sourcebucketname/sourceobjectkey', 'CopySourceRange' => 'bytes=0-10' ] ); printf ( "RequestId:%s\n", $resp ['RequestId'] ); printf ( "ETag:%s\n", $resp ['ETag'] ); printf ( "LastModified:%s\n", $resp ['LastModified'] ); } catch ( Obs\Common\ObsException $obsException ) { printf ( "ExceptionCode:%s\n", $obsException->getExceptionCode () ); printf ( "ExceptionMessage:%s\n", $obsException->getExceptionMessage () ); }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
