Product Documentation articleRestore a document: lq851
Added by IBM contributorYing BJ Mo | Edited by IBM contributorDana Liburdi on April 18, 2011 | Version 3
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.
Tags: API

Overview



This is the specification for applications that restore a Document resource to a previous version. The URL endpoints are the same as to Update a document service, however, it will perform a restore operation as long as the versionUuid attribute is specified in the request entry.

URL endpoints



Perform a PUT operation on one of the following URL formats:
URL
Description
/library/{library-id}/document/{document-id}/entry
Update the specified document
/library/{library-id}/draft/{draft-id}/entry Update the specified draft

Authentication



This method requires authentication. In order to restore a document, the currently authenticated user must be the owner of the user library containing the document, an administrator, or the document must have been shared with the current user as an editor. To test whether the current user can edit a document, use the Retrieve a Document API with the "acls" parameter equal to "true", and check the element for the "EditContent" or "EditProperties" flag.

Arguments



The following HTTP headers maybe supported for this operation.
Header
Description
Slug
Contains path and label of the resource. Non-ASCII characters can appear in this header. But they must be properly encoded according to the RFC 2047.
Content-Type
Used to specify the Mime type for the content being sent to the server. POST and PUT operations will return HTTP response code 400 (Bad request) when this header is not present in the incoming request. If the collection does not support the specified content type, the server will return HTTP response code 415 (Unsupported media type).
Content-LanguageUsed to specify the language for the content being sent to the server. All content is handled via UTF-8 encoding on the server.
Content-LengthUsed to specify the content length when sending media content. This is required when sending media otherwise HTTP response code 411 (Length required) will be returned.

The following entry attributes carry special meaning when put to a document entry:
Argument
Values
Description
td:versionUuid
String(uuid)
Indicates the version to restore the document to. The versionUuid passed in will be restored as a new current version. All other changes to values will be ignored if versionUuid is passed in.
td:changeSummaryStringA short summary of the changes like "Restore from version 1".

Error Code



Error Code
Description
Unknown
Returned when the cause of an error is unknown
AccessDenied
Returned when the cause of an error is due to a permission restriction
ItemNotFound
Returned when the cause of an error is related to a resource not being found

Example Request for Lotus Quickr 8.5 for Domino



POST /dm/atom/library/%5B@Ptest002/@RMain.nsf%5D/page/%5B@Ptest002/@RMain.nsf/@Dundefined%5D/entry?noAuthHeader=true HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0
<?xml version="1.0" encoding="utf-8"?>
<a:entry xmlns:a="http://www.w3.org/2005/Atom">
<changeSummary xmlns="urn:ibm.com/td">Restored from version: 2</changeSummary>
<versionUuid xmlns="urn:ibm.com/td">_Ptest002_RMain.nsf_DCA31454AD1668865482578540018705E</versionUuid>
</a:entry>


Example Response for Lotus Quickr 8.5 for Domino



<?xml version="1.0" encoding="utf-8" ?>
<entry xml:base="http://example.com/" xmlns="http://www.w3.org/2005/Atom" xmlns:td="urn:ibm.com/td">
<id>urn:lsid:ibm.com:td:_Ptest002_RMain_D2893762FDC47AC444825785A0038ECE7_V4</id>
<td:uuid>_Ptest002_RMain_D2893762FDC47AC444825785A0038ECE7</td:uuid>
<td:label>Blue hills</td:label>
<link href="dm/atom/library/_Ptest002_RMain/page/_Ptest002_RMain_Dundefined/version/4/entry" rel="self" />
<link href="LotusQuickr/test002/Main.nsf/h_Index/undefined?OpenDocument" rel="alternate" />
<link href="dm/atom/library/_Ptest002_RMain/page/_Ptest002_RMain_Dundefined/version/4/entry" rel="edit" />
<link href="dm/atom/library/_Ptest002_RMain/document/_Ptest002_RMain_Dundefined_ABlue_20hills.jpg/version/4/media" rel="attachment0"/>
<category term="version" scheme="tag:ibm.com,2006:td/type" label="version" />
<td:documentUuid>_Ptest002_RMain_Dundefined</td:documentUuid>
<td:versionLabel>4</td:versionLabel>
<author>
<uri>CN=testuser002/O=ibm</uri>
<name>testuser002</name>
<email></email>
</author>
<td:modifier>
<td:uri>CN=testuser002/O=ibm</td:uri>
<td:name></td:name>
<td:email></td:email>
</td:modifier>
<title type="text">Blue hills</title>
<updated>2011-03-21T10:21:46Z</updated>
<published>2011-03-21T10:21:46Z</published>
<td:created>2011-03-21T10:21:46Z</td:created>
<td:modified>2011-03-21T10:21:46Z</td:modified>
<summary type="html">
<![CDATA[Restored from version: 2]]>
</summary>
<content type="application/atom+xml" src="dm/atom/library/_Ptest002_RMain/page/_Ptest002_RMain_Dundefined/version/4/feed" />
</entry>