< Previous | Contents | Next >

4.4.4 Listing Versions

You can query HCP to discover what versions of an object are being maintained in the repository. The response body returned by HCP contains an XML document that lists the current and historic versions of an object and its metadata. Let’s modify the program listing in Section 2.2.1 to retrieve a version list for the object examples/world.txt.

String url = http://ns01.tn01.hcp01.hitachi.com/rest/examples/world.txt?" + "version=list”;

The GET method is used to download version lists. Setting the URL query parameter version to a value of list

requests a version list to be returned in the response body.

An XML document listing all versions of the object is returned in lieu of object data:

<?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/examples/world.txt" utf8path="/rest/examples/world.txt " parentDir="/rest/examples">

utf8ParentDir="/rest/examples"> deleted="false" showDeleted="true">

<entry urlName="world.txt" utf8Name="world.txt" type="object"

size="12" hashScheme="SHA-256" hash="D2A84F4B8B6..."

retention="0" retentionString="Deletion Allowed" retentionClass="" ingestTime="1258469462" ingestTimeString="11/17/2009 9:51AM" hold="false"

shred="false" dpl="2" index="true"

customMetadata="false" state="created" version="80232488492929"


<entry urlName="world.txt" utf8Name="world.txt" type="object"

size="14" hashScheme="SHA-256" hash="3672A83F3C0..."

retention="0" retentionString="Deletion Allowed" retentionClass="" ingestTime="1258405200" ingestTimeString="11/16/2009 4:00PM" hold="false"

shred="false" dpl="2" index="true"

customMetadata="false" state="deleted" version="80232488876481"



In this example we see that the object examples/world.txt has two versions: the current version and a historic one. Metadata for each is returned as XML attributes. The version ID field can be used to retrieve a particular version of the object. See Section 4.4.2: Retrieving Versions for more details on retrieving historic versions of an object.

For a summary of the XML format for version lists, see Section Object versions. For a complete description of the version list format, see Hitachi Content Platform: Using a Namespace.