Example 6: Performing a privileged delete

Here’s a sample HTTP DELETE request that deletes the object named
Q1_2012.ppt, which is under retention, from the quarterly_rpts directory in the namespace.

Request with curl command line

curl -k -iX DELETE
    -H "Authorization: HCP bXl1c2Vy:3f3c6784e97531774380db177774ac8d"
    -d "privileged=true"
    -d "reason=Deleted per Compliance Order 12323."
    "https://finance.europe.hcp.example.com/rest/quarterly_rpts/Q1_2012.ppt"

Request in Python using PycURL

import pycurl
import urllib
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPHEADER, ["Authorization: HCP
  bXl1c2Vy:3f3c6784e97531774380db177774ac8d"])
curl.setopt(pycurl.URL, "http://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.CUSTOMREQUEST, "DELETE")

args = {'privileged':'true',
  'reason':'Deleted per Compliance Order 12323.'}
args = urllib.urlencode(args)
curl.setopt(pycurl.POSTFIELDS, args)

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

 

Request headers

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

Request body

Contains the privileged and reason parameters as form-encoded data.

Response headers

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

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