Retrieve the contents of a page.
Name | Type | Description |
pageid | string | either an integer page ID, "home", or "=" followed by a double uri-encoded page path |
Name | Type | Description |
overview | bool? | Include the overview section. (default: false) |
include | bool? | Treat page as an include (default: false) |
reltopath | string? | Page used for path normalization. Ignored if relto parameter is defined. (default: none) |
relto | int? | Page used for path normalization (default: none) |
authenticate | bool? | Force authentication for request (default: false) |
pageid | int? | For template pages, use specified page ID as context for template invocation (default: none) |
includes | string? | Comma separated list of extra elements to include (choice of "overview", "tags". default: include nothing extra) |
format | {html, xhtml, text, dekicode}? | Result format. Text only valid in mode=view if the page was authored by someone with unsafecontent permission (default: html) |
highlight | string? | Comma separated list of terms to highlight (default: empty) |
revision | string? | Page revision to retrieve. 'head' by default will retrieve latest revision. Positive integer or a TimeUUID will retrieve specific revision |
mode | {edit, raw, view} | render content for different uses; default is 'view' |
redirects | int? | If zero, do not follow page redirects. |
section | int? | The section number (default: none) |
Name | Value | Description |
OK | 200 | The request completed successfully |
Non-Authoritative Information | 203 | Page contents could not be parsed in its native format and was returned in an alternative format instead |
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 |
Output:
<content type="{contenttype}"> <head>{text}</text> <body>{text}</body> <body target="{target}">{text}</body> ... <tail>{text}</tail> </content>
Additional information on available render modes:
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.
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();
<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>
Add notes about requirements or config values
The following command retrieves the contents of page "foo":
curl -u username:password -i http://mindtouch.address/@api/deki/pages/=foo/contents
Taken from a page with title "Gotham". The HTML data is sandwiched within the <content> element.
Content-Type: application/xml
<content type="text/html" title="Gotham"> <body> <p>Home of the Batman</p> </body> <body target="toc"><em>No headers</em></body> </content>