Example: Changing multiple metadata values for an existing object

Here’s a sample HTTP POST request that makes these changes to the metadata for the Q1_2012.ppt file:

Increases retention by one year from the current value

Turns on shredding on delete

Turns off indexing

Request with curl command line

curl -k -i -H "Authorization: HCP bXl1c2Vy:3f3c6784e97531774380db177774ac8d"
    -d "retention=R+1y" -d "shred=true" -d "index=false"
    "https://finance.europe.hcp.example.com/rest/quarterly_rpts/Q1_2012.ppt"

Request in Python using PycURL

import pycurl
curl = pycurl.Curl()
theHeader = ["Transfer-Encoding: chunked"]
curl.setopt(pycurl.HTTPHEADER, ["Authorization: HCP
  bXl1c2Vy:3f3c6784e97531774380db177774ac8d", theHeader])
curl.setopt(pycurl.URL, "https://finance.europe.hcp.example.com \
  /rest/quarterly_rpts/Q1_2012.ppt")
curl.setopt(pycurl.SSL_VERIFYPEER, 0)
curl.setopt(pycurl.SSL_VERIFYHOST, 0)
curl.setopt(pycurl.POST, 1)
theFields = "retention=R+1y&shred=true&index=false"
theHeader = ["Transfer-Encoding: chunked"]
curl.setopt(pycurl.POSTFIELDS, theFields)

curl.perform()
print curl.getinfo(pycurl.RESPONSE_CODE)
curl.close()

 

Request headers

POST /rest/quarterly_rpts/Q1_2012.ppt HTTP/1.1
Host: finance.europe.hcp.example.com
Authorization: HCP bXl1c2Vy:3f3c6784e97531774380db177774ac8d
Content-Length: 37
Content-Type: application/x-www-form-urlencoded

Response headers

HTTP/1.1 200 OK
X-HCP-ServicedBySystem: hcp.example.com
Content-Length: 0

Trademarks and Legal Disclaimer

© 2016 Hitachi Data Systems Corporation. All rights reserved.