+

Search Tips   |   Advanced Search

Use REST to work with versions

Item versions can be listed and read using the REST service.


Retrieve a list of versions

To retrieve a list of versions you issue a GET request to the following URI:

/item/item-uuid/versions
A feed is returned containing the identifying information of each version, along with a with relation "versioned-item" that links to the specified version.

Version link relations

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="namespace">
  ...
    <link rel="versions" href="/wps/mycontenthandler/!ut/p/wcmrest/item/0d678334-69ae-4d3a-a525-91bb551e5a18/versions"/>
  ...
</entry>

Versions feed

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="namespace">
    <entry>
        <link rel="versioned-item" href="/wps/mycontenthandler/!ut/p/wcmrest/item/0d678334-69ae-4d3a-a525-91bb551e5a18/version/2"/>
        <content>
            <wcm:versionContent>
                <wcm:versionName>2</wcm:versionName>
                <wcm:versionDate>2011-05-30T04:38:49.540Z</wcm:versionDate>
            </wcm:versionContent>
        </content>
    </entry>
    <entry>
        <link rel="versioned-item" href="/wps/mycontenthandler/!ut/p/wcmrest/item/0d678334-69ae-4d3a-a525-91bb551e5a18/version/1"/>
        <content>
            <wcm:versionContent>
                <wcm:versionName>1</wcm:versionName>
                <wcm:versionDate>2011-05-30T04:33:40.677Z</wcm:versionDate>
            </wcm:versionContent>
        </content>
    </entry>
</feed>


View the details of a version

To view the details of a specified version, you issue a GET request in the following format:

/item/item-uuid/version/version-name
For example:
GET HTTP/1.0
/wps/mycontenthandler/wcmrest/item/8f055ba2-1bc3-4d21-8443-86274e14dd2c/version/1
Host: www.example.com
Accept: application/atom+xml


HTTP/1.0 200 OK

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="namespace">
    <id>0d678334-69ae-4d3a-a525-91bb551e5a181</id>
    <title>SampleNumericComponentTitle</title>
    <link rel="edit" href="/wps/mycontenthandler/!ut/p/wcmrest/LibraryNumericComponent/0d678334-69ae-4d3a-a525-91bb551e5a181"/>
    <link rel="edit-media" type="text/plain" href="/wps/mycontenthandler/!ut/p/wcmrest/LibraryNumericComponent/0d678334-69ae-4d3a-a525-91bb551e5a181"/>
    <link rel="library" href="/wps/mycontenthandler/!ut/p/wcmrest/item/c98d11e1-7f2a-480e-9aac-40eb1949cbda"/>
    <link rel="create-draft" href="/wps/mycontenthandler/!ut/p/wcmrest/item/0d678334-69ae-4d3a-a525-91bb551e5a181/create-draft"/>
    <link rel="change-to-draft" href="/wps/mycontenthandler/!ut/p/wcmrest/item/0d678334-69ae-4d3a-a525-91bb551e5a181/change-to-draft"/>
    <link rel="versions" href="/wps/mycontenthandler/!ut/p/wcmrest/item/0d678334-69ae-4d3a-a525-91bb551e5a181/versions"/>
    <updated>2011-05-30T06:42:10.244Z</updated>
    <author>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/p/digest!6GVkh5Ul75Ln7DdEgvHm_g/um/users/profiles/Z9eAeH1C2JG561RC6JM47H9E4MMG6PHO6JM4C5JD0JMOC6BEEJS464JDG3I56K1</uri>
        <email></email>
        <name>wpsadmin</name>
    </author>
    <wcm:owner>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/p/digest!6GVkh5Ul75Ln7DdEgvHm_g/um/users/profiles/Z9eAeH1C2JG561RC6JM47H9E4MMG6PHO6JM4C5JD0JMOC6BEEJS464JDG3I56K1</uri>
        <email></email>
        <name>wpsadmin</name>
    </wcm:owner>
    <wcm:name>SampleNumericComponentNameUpdated</wcm:name>
    <wcm:description>SampleNumericComponentDescription</wcm:description>
    <wcm:type>LibraryNumericComponent</wcm:type>
    <wcm:state>PUBLISHED</wcm:state>
    <versionContent>
        <wcm:versionName>1</wcm:versionName>
        <wcm:versionDate>2011-05-30T04:33:40.677Z</wcm:versionDate>
    </versionContent>
</entry>


Parent: Work with web content items using REST