跳到主要内容

CopyObject

请求语法

PUT /objectName HTTP/1.1
Host: bucketname.cos.chinac.com
Date: GMT Date
Authorization: SignatureValue
x-cos-copy-source: /bucket/object

请求Header

NameTypeDescription
x-cos-copy-sourcestring复制源地址

细节分析

  1. 拷贝操作需要请求者对源Object有读权限;
  2. 源Object和目标Object必须属于同一个数据中心;
  3. 拷贝操作涉及到的请求头,都是以“x-cos-”开头的,所以要加入签名字符串中;
  4. 拷贝操作不限制源对象的对象大小
  5. 拷贝操作会复制所有对象的用户自定义元数据(已"x-cos-meta-"开头的)

示例

请求示例

PUT /cos.jpg HTTP/1.1
Host: test-bucket.cos.chinac.com
Date: Fri, 24 Feb 2012 06:03:28 GMT
Content-Type: image/jpg
Content-Length: 344606
Content-MD5: bb69583fd4da5970a86aa47c0da561ad
Authorization: COS qn6qrrqxo2oawuk53otfjbyc:kZoYNv66bsmc10+dcGKw5x2PRrk=
x-cos-copy-source: /test-bucket/source.jpg

返回示例

HTTP/1.1 200 OK
Server: COS
Date: Sat, 21 Nov 2015 18:52:34 GMT
Content-Length: 0
Connection: keep-alive
x-cos-request-id: 5650BD72207FB30443962F9A
ETag: "A797938C31D59EDD08D86188F6D5B872"

{
"LastModified" : "2009-10-28T22:32:00",
"ETag" : "9b2cf535f27731c974343645a3985328"
}