HCP Tenant Management Help


Example: Listing the contents of a directory that includes deleted objects

Here’s a sample HTTP GET request that lists all the contents, including any deleted objects or subdirectories, of a directory named quarterly_rpts in a namespace that supports versioning.

Request with curl command line

curl -k -H "Authorization: HCP bXl1c2Vy:3f3c6784e97531774380db177774ac8d"
    "https://finance.europe.hcp.example.com/rest/quarterly_rpts?deleted=true"
    > quarterly_rpts.xml

Request in Python using PycURL

import pycurl
filehandle = open("quarterly_rpts.xml", 'wb')
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPHEADER, ["Authorization: HCP
  bXl1c2Vy:3f3c6784e97531774380db177774ac8d"])
curl.setopt(pycurl.URL, "https://finance.europe.hcp.example.com \
  /rest/quarterly_rpts?deleted=true")
curl.setopt(pycurl.SSL_VERIFYPEER, 0)
curl.setopt(pycurl.SSL_VERIFYHOST, 0)
curl.setopt(pycurl.WRITEFUNCTION, filehandle.write)
curl.perform()
print curl.getinfo(pycurl.RESPONSE_CODE)
curl.close()
filehandle.close()

 

Request headers

GET /rest/quarterly_rpts?deleted=true HTTP/1.1
Host: finance.europe.hcp.example.com
Authorization: HCP bXl1c2Vy:3f3c6784e97531774380db177774ac8d

Response headers

HTTP/1.1 200 OK
X-HCP-ServicedBySystem: hcp.example.com
X-HCP-Time: 1335036864
X-HCP-SoftwareVersion: 7.0.0.16
Content-Type: text/xml
X-HCP-Type: directory
X-HCP-ChangeTimeMilliseconds: 1353420657688.00
X-HCP-ChangeTimeString: 2012-11-20T09:10:57-0500
Content-Length: 577

Response body

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/static/xsl/ns-directory.xsl"?>
<directory xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="/static/xsd/ns-directory.xsd"
    path="/rest/quarterly_rpts"
    utf8Path="/rest/quarterly_rpts"
    parentDir="/rest">
    utf8ParentDir="/rest"
    dirDeleted="false"
    showDeleted="true"
    namespaceName="finance"
    utf8NamespaceName="finance">
    changeTimeMilliseconds="1326336965436"
    changeTimeString="2012-01-11T09:56:05-0500"

    <entry urlName="Q4_2011.ppt"
         utf8Name="Q4_2011.ppt"
         type="object"
         size="671744"
         hashScheme="SHA-256"
         hash="42C605FBFFCD7CEAC36BE62F294374F94503D1DC1793736EF367..."
         retention="0"
         retentionString="Deletion Allowed"
         retentionClass=""
         ingestTime="1326898187"
         ingestTimeString="1/18/2012 2:49PM"
         hold="false"
         shred="false"
         dpl="2"
         index="true"
         customMetadata="false"
         customMetadataAnnotations=""
         version="80238375537921"
         replicated="false"
         changeTimeMilliseconds="1326898187533.00"
         changeTimeString="2012-01-18T14:49:47-0400"
         owner="lgreen"
         domain=""
         hasAcl="false"
         state="created"
    />
    <entry urlName="obsolete"
         utf8Name="obsolete"
         type="directory"
         changeTimeMilliseconds="1331847677748.00"
         changeTimeString="2012-03-15T17:41:17-0400"
         state="deleted"
    />
    <entry urlName="Q1_2012.ppt"
         utf8Name="Q1_2012.ppt"
         type="object"
         size="678400"
         hashScheme="SHA-256"
         hash="E830B86212A66A792A79D58BB185EE63A4FADA76BB8A1C257C01..."
         retention="0"
         retentionString="Deletion Allowed"
         retentionClass=""
         ingestTime="1334847117"
         ingestTimeString="4/19/2012 9:51AM"
         hold="false"
         shred="false"
         dpl="2"
         index="true"
         customMetadata="false"
         customMetadataAnnotations=""
         version="80238376132993"
         replicated="false"
       changeTimeMilliseconds="1334847117598.00"
         changeTimeString="2012-04-19T09:51:57-0400"
         owner="lgreen"
         domain=""
         hasAcl="false"
         state="created"
    />
</directory>

Notice that the obsolete directory was deleted. It does not appear in a directory listing if the URL does not include the deleted=true parameter.

© 2015, 2019 Hitachi Vantara Corporation. All rights reserved.