tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Upload Part - Copy

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2024-06-12 15:10:38

Overview

This API is used to copy the parts of an object from the source path to the destination path. You can use x-cos-copy-source to specify the source object and use x-cos-copy-source-range to specify the byte range to copy (each part should be 1 MB to 5 GB).
Note:
The following two types of accounts can call this API:
Have the root account permissions.
Have the GetObjecet API permission of the source object and the InitiateMultipartUpload, ListMultipartUploads, ListParts, PutObject, CompleteMultipartUpload, and AbortMultipartUpload API permissions under the destination path.
Note:
To call this API, you need to first call the Initiate Multipart Upload API to initialize the multipart upload and specify the destination path.
If the source and destination objects reside in two different regions and the part size is larger than 5 GB, use the multipart upload or multipart copy API to copy the object.
To upload an object in parts, you must first initialize the multipart upload. The response of the multipart upload initialization will include a unique descriptor uploadId, which needs to be carried in the multipart upload request.


Versioning

If versioning is enabled for the bucket, x-cos-copy-source identifies the current version of the object to copy. If the current version is a delete marker and no version is specified in x-cos-copy-source, COS will consider that the object has been deleted and return a 404 error. If you specify a versionId in x-cos-copy-source and the versionId is a delete marker, COS will return an HTTP 400 error as delete markers cannot be set in x-cos-copy-source.

Request

Sample request

PUT /<ObjectKey>?partNumber=PartNumber&uploadId=UploadId HTTP/1.1
Host: <Bucketname-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Authorization: Auth String
x-cos-copy-source: <Bucketname>-<APPID>.cos.<Region>.myqcloud.com/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
Note:
Host:<BucketName-APPID>.cos.<Region>.myqcloud.com, where <BucketName-APPID> is the is the bucket name followed by the APPID, such as examplebucket-1250000000 (see Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Conventions), and <Region> is a COS region (see Regions and Access Endpoints).
Authorization: Auth String (See Request Signature for details.)

Request headers

Common request headers

This API uses Common Request Headers.

Non-common request headers

Required headers
This API uses the following required header:
Header
Description
Type
Required
x-cos-copy-source
URL of the source object. You can use versionid to specify the versionId of the object.
String
Yes
Recommended headers
This API uses the following recommended headers:
Header
Description
Type
Required
x-cos-copy-source-range
Byte range of the source object. The range value must be in the format of bytes=first-last, where both first and last are offsets starting from 0.
For example, bytes=0-9 means that you want to copy the first 10 bytes of data of the source object. If this parameter is not specified, the entire object will be copied.
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. If it is used together with other conditions, a conflict will be returned.
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 together with x-cos-copy-source-If-Match. If it is used together with other conditions, a conflict will be returned.
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 together with x-cos-copy-source-If-Unmodified-Since. If it is used together with other conditions, a conflict will be returned.
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 together with x-cos-copy-source-If-Modified-Since. If it is used together with other conditions, a conflict will be returned.
string
No

Request parameters

Parameter
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

Non-common response headers

Header
Description
Type
x-cos-copy-source-version-id
Version ID of the source object to copy (if versioning is enabled for the source bucket)
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 nodes are described as follows:
Parameter
Description
Type
CopyPartResult
Results of the copy
String
ETag
MD5 checksum of the object. ETag can be used to check whether the object content has changed.
String
LastModified
Last modified time of the object, in GMT format
String

Error codes

This API returns common error responses and error codes. For more information, see Error Codes.

Examples

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:examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/exampleobject1
x-cos-copy-source-range: bytes=10-100
Host: examplebucket-1250000000.cos.ap-shanghai.myqcloud.com
Authorization:q-sign-algorithm=sha1&q-ak=AKIDDNMEycgLRPI2axw9xa2Hhx87wZ3M****&q-sign-time=1507530223;1508530223&q-key-time=1507530223;1508530223&q-header-list=&q-url-param-list=&q-signature=d02640c0821c49293e5c289fa07290e6b2f0****

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
Server: tencent-cos
x-cos-request-id: NTlkYjFjYWJfMjQ4OGY3MGFfNGIz****

<CopyPartResult>
<ETag>"ba82b57cfdfda8bd17ad4e5879ebb4fe"</ETag>
<LastModified>2017-09-04T04:45:45</LastModified>
</CopyPartResult>


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan