MindTouch Developer Center > MindTouch Deki > API Reference > GET:pages/{pageid}/contents

Overview

public. Retrieve the contents of a page.

Uri Parameters
NameTypeDescription
pageidstringeither an integer page ID, "home", or "=" followed by a double uri-encoded page title
Query Parameters
NameTypeDescription
format{html, xhtml}?Result format (default: html)
highlightstring?Comma separated list of terms to highlight (default: empty)
mode{edit, raw, view, viewnoexecute}render content for different uses; default is 'view'
redirectsint?If zero, do not follow page redirects.
revisionstring?Page revision to retrieve. 'head' by default will retrieve latest revision. positive integer will retrieve specific revision
sectionint?the section number
Return Codes
NameValueDescription
BadRequest400Invalid input parameter or request body
Forbidden403Update access to the page is required
NonAuthoritativeInformation203Page contents could not be parsed in its native format and was returned in an alternative format instead
NotFound404Requested page could not be found
Ok200The request completed successfully

Message Format

Output:

<content type="{contenttype}">    
  <head>{text}</text>   
  <body>{text}</body>   
  <body target="{target}">{text}</body>  
  ...
  <tail>{text}</tail>   
</content>

Implementation Notes

Additional information on available render modes: 

  • Edit:  Retrieves the contents used to render the page within the editor.  Links and images are displayed in an editor-consumable format, functions are not evaluated, and no table of contents is generated.   Editorial comments, indicated by <span class="comment">,  are displayed.
  • Raw: Retrieves the contents stored in the database.  No processing is performed.
  • View: Retrieves the contents used to render the page for viewing.  Functions are evaluated and a table of contents is generated.  Free links are automatically resolved into hyperlinks.
  • ViewNoExecute:  Retrieves the contents used to perform a diff.  This mode is identical to View, except that functions are not evaluated.

Setting Revision=1 retrieves the earliest revision, 2 retrieves the next earliest revision, and so on.  Similarly, Revision=-1 retrieves the revision prior to the current, -2 retrieves the revision two prior to the current, and so on.

The head section contains any JavaScript that needs to be executed before the page is loaded, the body section contains the HTML body of the page, and the tail section contains any JavaScript that needs to be executed after the page is loaded. 


Use POST:pages/{pageid}/contents to set the page contents.

Code Samples

The following code example retrieves the view mode contents of the page called "Page_Title":

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

Sample response:

<content type="application/x.deki0702+xml">
    <body>
        <a name="Section1"></a>
        <h2>Section1</h2> 
        <p>section1 text</p>
    </body>     
    <body target="toc">
        <ol style="list-style-type:none; margin-left:0px; padding-left:0px;">
            <li>1. 
                <a href="http://deki-hayes/Page_Title#Section1" rel="internal">Section1</a>
            </li>
        </ol>
    </body> 
</content>

  

Tag page
You must login to post a comment.