Example: Listing the versions of an object

Here’s a sample HTTP GET request that saves an XML listing of the versions of an object named Q1_2012.ppt located in the quarterly_rpts directory. The object has three versions: the original version that was ingested, a deleted version, and a version that was ingested after the original version was deleted. The request asks for all versions, including deleted versions.

Request with curl command line

curl -i -k -H "Authorization: HCP bXl1c2Vy:3f3c6784e97531774380db177774ac8d"
    "https://finance.europe.hcp.example.com/rest/quarterly_rpts/
    Q1_2012.ppt?version=list&deleted=true" > Q1_2012-versions.xml

Request in Python using PycURL

import pycurl
filehandle = open("Q1_2012-versions.xml", 'wb')
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPHEADER, ["Authorization: HCP
  bXl1c2Vy:3f3c6784e97531774380db177774ac8d"])
curl.setopt(pycurl.URL, "https://finance.europe.hcp.example.com/ \
  quarterly_rpts/Q1_2012.ppt?version=list&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)
filehandle.close()
curl.close()

 

Request headers

GET /rest/quarterly_rpts/Q1_2012.ppt?version=list&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: 1334915508
X-HCP-SoftwareVersion: 7.0.0.16
Content-Type: text/xml
Content-Length: 2080

Response body

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/static/xsl/ns-versions.xsl"?>
<versions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="/static/xsd/ns-versions.xsd"
        path="/rest/quarterly_rpts/Q1_2012.ppt"
        utf8path="/rest/quarterly_rpts/Q1_2012.ppt"
        parentDir="/rest/quarterly_rpts">
         utf8ParentDir="/rest/quarterly_rpts">
         deleted="false"
         showDeleted="true"
        namespaceName="finance"
         utf8NamespaceName="finance">
    <entry urlName="Q1_2012.ppt"
             utf8Name="Q1_2012.ppt"
             type="object"
             size="678400"
             hashScheme="SHA-256"
             hash="42C605FBFFCD7CEAC36BE62F294374F94503D1DC1793736EF..."
             retention="0"
             retentionString="Deletion Allowed"
             retentionClass=""
             hold="false"
             shred="false"
             dpl="2"
             index="true"
             customMetadata="false"
             customMetadataAnnotations=""
             replicated="false"
             owner="lgreen"
             domain=""
             hasAcl="false"
             state="created"
             version="80232488492929"
             ingestTime="1334829108"
             ingestTimeString="4/19/2012 9:51AM"
             changeTimeMilliseconds="1335347627362.00"
             changeTimeString="2012-04-25T09:53:47-0400"
    />
    <entry urlName="Q1_2012.ppt"
             utf8Name="Q1_2012.ppt"
             type="object"
             size="678400"
             hashScheme="SHA-256"
             hash="36728BA190BC4C377FE4C1A57AEF9B6AFDA98720422960B19..."
             retention="0"
             retentionString="Deletion Allowed"
             retentionClass=""
             hold="false"
             shred="false"
             dpl="2"
             index="true"
             customMetadata="false"
             customMetadataAnnotations=""
             replicated="false"
             owner="lgreen"
             domain=""
             hasAcl="false"
             state="deleted"
             version="80232488876481"
             ingestTime="1334829108"
             ingestTimeString="4/19/2012 9:51AM"
             changeTimeMilliseconds="1335607118753.00"
             changeTimeString="2011-04-28T09:58:38-0400"
    />
    <entry urlName="Q1_2012.ppt"
             utf8Name="Q1_2012.ppt"
             type="object"
             size="785690"
             hashScheme="SHA-256"
             hash="36728BA190BC4C377FE4C1A57AEF9B6AFDA98720422960B19..."
             retention="0"
             retentionString="Deletion Allowed"
             retentionClass=""
             hold="false"
             shred="false"
             dpl="2"
             index="true"
             customMetadata="false"
             customMetadataAnnotations=""
             replicated="false"
             owner="lgreen"
             domain=""
             hasAcl="false"
             state="created"
             version="80232489767169"
             ingestTime="1335613062"
             ingestTimeString="4/28/2012 11:37AM"
             changeTimeMilliseconds="1335627338110.00"
             changeTimeString="2012-04-28T15:35:38-0400"
    />
</versions>

Trademarks and Legal Disclaimer

© 2016 Hitachi Data Systems Corporation. All rights reserved.