pages/{pageid}/revert (POST)
Overview
Revert page to an earlier revision
- REST Method: POST
 - Method Access: public
 
Uri Parameters
| Name | Type | Description | 
| pageid | string | either an integer page ID, "home", or "=" followed by a double uri-encoded page path | 
Query Parameters
| Name | Type | Description | 
| authenticate | bool? | Force authentication for request (default: false) | 
| verbose | bool? | Specify if you want the conflicted elements to be returned in the response | 
| redirects | int? | If zero, do not follow page redirects. | 
| abort | {never, conflict}? | Specify the condition under which to prevent the revert operation. Defaults to 'conflict' | 
| fromrevision | string? | Revision number of page or a TimeUUID that will become the new head revision | 
Return Codes
| Name | Value | Description | 
| OK | 200 | The request completed successfully | 
| Bad Request | 400 | Invalid input parameter or request body | 
| Forbidden | 403 | Update access to the page is required | 
| Not Found | 404 | Requested page could not be found | 
Implementation Notes
Setting Fromrevision=1 reverts to the earliest revision, 2 reverts to the next earliest revision, and so on. Similarly, Fromrevision=-1 reverts to the revision prior to the current, -2 reverts to the revision two prior to the current, and so on.
Use GET:pages/{pageid}/revisions to retrieve page revision information.
C# Code Sample: Revert a Page to First Revision
The following code example reverts the home page to its original contents:
Sample Code
Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
p.At("pages", "home", "revert").With("fromrevision", 1).Post();;
Curl Code Sample: Revert a Page
The following command reverts page "foo" to the revision number declared in the "fromrevision" parameter. The rules for the value of the parameter are outlined here.
Sample Code
curl -u username:password -d "" -i http://mindtouch.address/@api/deki/pages/=foo/revert?fromrevision=1
Implementation notes
curl flags
- -u
 - Basic HTTP authentication. Sends a username and password to server so it can verify whether a user is of privilege to perform specific operation.
 - -d
 - Specifies a POST request. The parentheses ("") imply no data, since no external data is required to complete the operation.
 - -i
 - Includes the HTTP response header in the output. Useful for debugging.
 
Example
The following example reverts the page "Code" one revision back. Note that a page has to be revised at least once for the operation to succeed.
Sample Code
curl -u username:password -d "" -i http://192.168.168.110/@api/deki/pages/=Code/revert?fromrevision=-1
HTTP Response Headers
HTTP/1.1 200 OK Date: Sat, 09 Jan 2010 01:22:16 GMT Server: Dream-HTTPAPI/1.7.2.17433 X-Deki-Site: id="default" Content-Length: 0 Via: 1.1 dekiwiki Content-Type: text/plain

