Here’s a sample PUT request that copies an old version of an object to the same object, thereby creating a new current version from the old version. The object in question is named AcctgBestPractices.doc and is in the finance bucket. The version ID of the version being copied is 87288808614529. The request is being made while versioning is enabled for the bucket.
Request with s3curl command line
./s3curl.pl --id=lgreen
--copysrc=/finance/ AcctgBestPractices.doc?versionId=87288808614529 -- -k
"https://finance.europe.hcp.example.com/AcctgBestPractices.doc"
-H "x-hcp-pretty-print:true"
Request headers
PUT /AcctgBestPractices.doc HTTP/1.1
Host: finance.europe.hcp.example.com
Date: Thu, 20 Dec 2012 19:42:16 +0000
Authorization: AWS bGdyZWVu:AZ/GOgJJXFh7K1pr59bIlwRUrc0=
x-amz-copy-source: /finance/AcctgBestPractices.doc?versionId=87288808614529
x-hcp-pretty-print: true
Response headers
HTTP/1.1 200 OK
Date: Thu, 20 Dec 2012 19:42:16 GMT
Server: HCP V7.0.0.16
x-amz-version-id: 87288815588289
ETag: "764f38262c6e581f678e1ac9b0211ae8"
x-amz-copy-source-version-id: 87288808614529
Content-Type: application/xml;charset=UTF-8
Transfer-Encoding: chunked
Response body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<CopyObjectResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LastModified>2012-02-20T19:42:16.000Z</LastModified>
<ETag>"764f38262c6e581f678e1ac9b0211ae8"</ETag>
</CopyObjectResult>
© 2016 Hitachi Data Systems Corporation. All rights reserved.