Skip to main content
MindTouch Success Center

pages/{pageid}/revisions (GET) (MT4)

Overview

Retrieve revision history of a given title

  • REST Method: GET
  • Method Access: public

Uri Parameters

Name Type Description
pageid string either an integer page ID, "home", or "=" followed by a double uri-encoded page title

Query Parameters

Name Type Description
authenticate bool? Force authentication for request (default: false)
offset int? Number of items to skip. Must be a positive number or 0 to not skip any. (default: 0)
revision string? Page revision to retrieve. Positive integer or a GUID will retrieve the specific revision
redirects int? If zero, do not follow page redirects.
deleted bool? Include deleted revisions (default: true)
limit string? Maximum number of items to retrieve. Must be a positive number or 'all' to retrieve all items. (default: 50)

Return Codes

Name Value Description
OK 200 The request completed successfully
Bad Request 400 Invalid input parameter or request body
Forbidden 403 Read access to the page is required
Not Found 404 Requested page could not be found

Message Format

Output:

<pages>
    <page id="{int}" revision="{int}" href="{uri}">
        <title>{text}</title> 
        <path>{text}</path> 
        <date.edited>{date}</date.edited> 
        <user.author id="{int}" href="{uri}">
            <nick>{text}</nick> 
            <username>{text}</username> 
            <email>{text}</email> 
        </user.author>
        <description>{text}</description> 
        <contents type="{contenttype}" href="{uri}" /> 
    </page>
    ...
</pages>

Implementation Notes

A new page revision is created whenever the page is modified.

Use GET:pages/{pageid}/contents with the revision parameter to retrieve the contents of a page from a specified revision.  It is also possible to compare the contents of two revisions with GET:pages/{pageid}/diff.

C# Code Sample: Retrieve Page Revisions

The following code example retrieves the revisions of the page called "Page Title":

Sample Code

Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
p.At("pages", "=Page_Title", "revisions").Get();

Sample Response from executing Code

Sample response indicating that there is one revision:

<pages>
    <page id="31" revision="1" href="http://deki-hayes/@api/deki/pages/31/revisions?revision=1&redirects=0">
        <title>Page Title</title> 
        <path>Page_Title</path> 
        <date.edited>2007-08-29T23:03:18Z</date.edited> 
        <user.author id="1" href="http://deki-hayes/@api/deki/users/1">
            <nick>Admin</nick> 
            <username>Admin</username> 
            <email>admin@mindtouch.com</email> 
        </user.author>
        <description>2 words added</description> 
        <contents type="application/x.deki0702+xml" href="http://deki-hayes/@api/deki/pages/31/revisions/contents?revision=1&redirects=0" /> 
    </page>
</pages>

Curl Code Sample: Retrieve Page Revisions

The following command retrieves a list of all revisions made on page "foo":

Sample Code

curl -u username:password -i http://mindtouch.address/@api/deki/pages/=foo/revisions

Sample Response from executing Code

Here is an example revision metadata of a page that has gone through 2 edits (creating 3 versions and revisions).

Content-Type: application/xml

<pages>
  <page id="567" revision="3" href="http://192.168.59.128/@api/deki/pages/567/revisions?revision=3&redirects=0">
    <uri.ui>http://192.168.59.128/FUBAR</uri.ui>
    <title>FUBAR</title>
    <path>FUBAR</path>
    <namespace>main</namespace>
    <date.edited>2010-01-29T18:41:40Z</date.edited>
    <user.author id="1" href="http://192.168.59.128/@api/deki/users/1">
      <nick>Admin</nick>
      <username>Admin</username>
      <email hidden="true"/>
      <hash.email>64e1b8d34f425d19e1ee2ea7236d3028</hash.email>
      <uri.gravatar>http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028</uri.gravatar>
    </user.author>
    <description>1 words added, 6 words removed</description>
    <contents type="application/x.deki0805+xml" href="http://192.168.59.128/@api/deki/pages/567/contents?revision=3&redirects=0"/>
  </page>
  <page id="567" hidden="true" revision="2" href="http://192.168.59.128/@api/deki/pages/567/revisions?revision=2&redirects=0">
    <uri.ui>http://192.168.59.128/FUBAR</uri.ui>
    <title hidden="true">FUBAR</title>
    <path>FUBAR</path>
    <namespace>main</namespace>
    <date.edited>2010-01-21T01:45:58Z</date.edited>
    <user.author id="1" href="http://192.168.59.128/@api/deki/users/1">
      <nick>Admin</nick>
      <username>Admin</username>
      <email hidden="true"/>
      <hash.email>64e1b8d34f425d19e1ee2ea7236d3028</hash.email>
      <uri.gravatar>http://www.gravatar.com/avata
r/64e1b8d34f425d19e1ee2ea7236d3028</uri.gravatar>
    </user.author>
    <description hidden="true"/>
    <contents type="application/x.deki0805+xml" href="http://192.168.59.128/@api/deki/pages/567/contents?revision=2&redirects=0"/>
    <user.hiddenby id="88" href="http://192.168.59.128/@api/deki/users/88">
      <nick>test6</nick>
      <username>test6</username>
      <email hidden="true"/>
      <hash.email>989d7c3b24422e0f2ab2da41e3a91434</hash.email>
      <uri.gravatar>http://www.gravatar.com/avatar/989d7c3b24422e0f2ab2da41e3a91434</uri.gravatar>
    </user.hiddenby>
    <date.hidden>2010-01-29T21:06:11Z</date.hidden>
    <description.hidden/>
  </page>
  <page id="567" revision="1" href="http://192.168.59.128/@api/deki/pages/567/revisions?revision=1&redirects=0">
    <uri.ui>http://192.168.59.128/FUBAR</uri.ui>
    <title>FUBAR</title>
    <path>FUBAR</path>
    <namespace>main</namespace>
    <date.edited>2010-01-19T19:24:52Z</date.edited>
    <user.author id="1" href="http://192.168.59.128/@api/deki/users/1">
      <nick>Admin</nick>
      <username>Admin</username>
      <email hidden="true"/>
      <hash.email>64e1b8d34f425d19e1ee2ea7236d3028</hash.email>
      <uri.gravatar>http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028</uri.gravatar>
    </user.author>
    <description>page created, 9 words added</description>
    <contents type="application/x.deki0805+xml" href="http://192.168.59.128/@api/deki/pages/567/contents?revision=1&redirects=0"/>
  </page>
</pages>

Implementation notes 

curl flags

-u
Provides external user authentication. Note that if anonymous access is available and authentication is not forced, this flag may be omitted.
-i
Outputs the HTTP response headers. Useful for debugging.

Pages

To view a list of all pages, follow the instructions here.
  • Was this article helpful?