Example: Deleting multiple objects

Here’s a sample POST request on the finance bucket to delete objects named quarterly_rpts/Q2_2019.ppt and quarterly_rpts/Q3_2019.ppt.

Request with s3curl command line

./s3curl.pl --id=lgreen --contentType application/xml --calculateContentMd5 --post mod.xml -- -ik -v
     "https://europe.hcp.example.com/finance?delete"

Request headers

POST /finance?delete HTTP/1.1
Host: europe.hcp.example.com/finance
Date: Fri, 07 February 2020 17:19:26 +0000
Authorization: AWS bGdyZWVu:i9bRonH4gi1SrymsF0Fw84mWUeQ=
Content-type: application/xml
Content-MD5: BQ7HxZ32wHoDbnACnRE79w==
Content-Length: 275

Request body

<?xml version="1.0" encoding="UTF-8"?>
<Delete>
     <Object>
          <Key>quarterly_rpts/Q2_2019.ppt</Key>
     </Object>
     <Object>
          <Key>quarterly_rpts/Q3_2019.ppt</Key>
     </Object>
</Delete>

Response headers

HTTP/1.1 200 OK
Date: Fri, 07 February 2020 17:19:26 GMT
Content-Type: application/xml
Content-Length: 731

Response body

<?xml version="1.0" encoding="UTF-8"?>
<DeleteResult>
     <Deleted>
          <Key>quarterly_rpts/Q2_2019.ppt</Key>
          <VersionId>97302435810137</VersionId>
          <DeleteMarker>true</DeleteMarker>
          <DeleteMarkerVersionId>Not Implemented</DeleteMarkerVersionId>
     </Deleted>
     <Error>
          <Key>quarterly_rpts/Q3_2019.ppt</Key>
          <Code>AccessDenied</Code>
          <Message>Access Denied</Message>
     </Error>
</DeleteResult>

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