Example 3: Replacing custom metadata for an existing object

Here’s a sample PUT request that replaces the existing custom metadata for the object named hum_res/budget_proposals/BudgProp-2020 in the finance bucket with new custom metadata. The request is being made while versioning is disabled for the bucket, so the custom metadata is replaced on the current version of the object. No new version is created.

Request with s3curl command line

./s3curl.pl --id=lgreen
     --copysrc=/finance/hum_res/budget_proposals/BudgProp-2020 -- -k
     "https://finance.europe.hcp.example.com/hum_res/budget_proposals/
             BudgProp-2020" -H "x-amz-meta-author: Robin Silver"
     -H "x-amz-meta-department: Human Resources"
     -H "x-amz-metadata-directive: REPLACE" -H "x-hcp-pretty-print: true"

Request headers

PUT /hum_res/budget_proposals/BudgProp-2020 HTTP/1.1
Host: finance.europe.hcp.example.com
Date: Fri, 07 February 2020 17:19:26 +0000
Authorization: AWS bGdyZWVu:WAamEr9PkL76M/kWkFu5K2rY9Bs=
x-amz-copy-source: /finance/hum_res/budget_proposals/BudgProp-2020
x-amz-meta-author: Robin Silver
x-amz-meta-department: Human Resources
x-amz-metadata-directive: REPLACE
x-hcp-pretty-print: true

Response headers

HTTP/1.1 200 OK
Date: Fri, 07 February 2020 17:19:26 GMT
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>2017-02-23T17:19:26.062Z</LastModified>
     <ETag>"76216527ff2f6219f7c29251a619c8db"</ETag>
</CopyObjectResult>

© 2015, 2020 Hitachi Vantara LLC. All rights reserved.