pages/{pageid} (GET)
Overview
Retrieve aggregate page information including attachments
- 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 path |
Query Parameters
Name | Type | Description |
format | {html, xhtml}? | Result format (default: html) |
revision | string? | Page revision to retrieve. 'head' by default will retrieve latest revision. Positive integer or a GUID will retrieve specific revision |
include | string? | Extra elements to include (choice of "contents","prevnext"; default: include nothing extra) |
includeDeleted | bool | When pageid is an integer page ID, and this parameter is set to true, we will even return the page if it was deleted at some point |
mode | {edit, raw, view} | render content for different uses; default is 'view' |
authenticate | bool? | Force authentication for request (default: false) |
redirects | int? | If zero, do not follow page redirects. |
exclude | string? | Elements to exclude from response document (choice of "inbound", "outbound", "files"; default: exclude nothing) |
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:
<page id="{int}" href="{uri}"> <title>{text}</title> <path>{text}</path> <metrics> <metric.views>{int}</metric.views> <metric.charcount>{int}</metric.charcount> </metrics> <summary>{text}</summary> <security href="{uri}"> <permissions.effective> <operations mask="{int}">{text}</operations> </permissions.effective> <permissions.page> <operations mask="{int}">{text}</operations> <restriction>{text}</restriction> </permissions.page> <grants> <grant> <permissions> <operations mask="{int}">{text}</operations> <role id="{int}" href="{uri}">{text}</role> </permissions> <user id="{int}" href="{uri}"> <nick>{text}</nick> <username>{text}</username> <email>{text}</email> </user> <date.expires>{date}</date.expires> <date.modified>{date}</date.modified> <user.modifiedby id="{int}" href="{uri}"> <nick>{text}</nick> <username>{text}</username> <email>{text}</email> </user.modifiedby> </grant> <grant> <permissions> <operations mask="{int}">{text}</operations> <role id="{int}" href="{uri}">{text}</role> </permissions> <group id="{int}" href="{uri}"> <name>{text}</name> </group> <date.expires>{date}</date.expires> <date.modified>{date}</date.modified> <user.modifiedby id="{int}" href="{uri}"> <nick>{text}</nick> <username>{text}</username> <email>{text}</email> </user.modifiedby> </grant> ... </grants> </security> <date.edited>{date}</date.edited> <date.modified>{date}</date.modified> <user.author id="{int}" href="{uri}"> <nick>{text}</nick> <username>{text}</username> <email>{text}</email> </user.author> <description>{text}</description> <page.redirectedfrom> <page id="{int}" href="{uri}"> <title>{text}</title> <path>{text}</path> </page> </page.redirectedfrom> <subpages href="{uri}" /> <outbound count="{int}"> <page id="{int}" href="{uri}"> <title>{text}</title> <path>{text}</path> </page> ... </outbound> <inbound count="{int}"> <page id="{int}" href="{uri}"> <title>{text}</title> <path>{text}</path> </page> ... </inbound> <aliases href="{uri}" /> <revisions count="{int}" href="{uri}" /> <revisions.archive count="{int}" href="{uri}" /> <comments count="{int}" href="{uri}" /> <files count="{int}"> <file id="{int}" href="{uri}"> <filename>{text}</filename> <description>{text}</description> <contents type="mimetype" size="{int}" width="{int}" height="{int}" href="{uri}" /> <contents.preview rel="thumb" type="{mimetype}" maxwidth="{int}" maxheight="{int}" href="{uri}" /> <contents.preview rel="webview" type="{mimetype}" maxwidth="{int}" maxheight="{int}" href="{uri}" /> <date.created>{date}</date.created> <user.createdby id="{int}" href="{uri}"> <nick>{text}</nick> <username>{text}</username> <email>{text}</email> </user.createdby> <revisions count="{int}" href="{uri}" /> </file> ... </files> <contents type="application/x.deki0702+xml" href="{uri}" /> </page>
Implementation Notes
This feature is useful when a variety of information is required about the page. If only one type of information is needed, such as files or page security settings, it is more efficient to call the feature specifically designed for this purpose.
C# Code Sample: Retrieve Page Info
The following code example retrieves a summary of all information available for the home page:
Sample Code
Plug p = Plug.New("http://deki-hayes/@api/deki"); p.At("users", "authenticate").WithCredentials("admin", "password").Get(); p.At("pages", "home").Get();
Retrieve the page "Page/SubPage":
Plug p = Plug.New("http://deki-hayes/@api/deki"); p.At("users", "authenticate").WithCredentials("admin", "password").Get(); string pageName = XUri.DoubleEncodeSegment("Page/Subpage"); p.At("pages", "=" + pageName).Get();
Implementation notes
Add notes about requirements or config values
Curl Code Sample: Retrieve Page Info
The following command retrieves aggregate information of page "foo":
Sample Code
curl -u username:password -i http://mindtouch.address/@api/deki/pages/=foo
Sample Response from executing Code
{pageid} = home
<page id="21" href="http://192.168.59.128/@api/deki/pages/21?redirects=0" revision="2"> <uri.ui>http://192.168.59.128/</uri.ui> <title>Best Wiki Ever</title> <path/> <namespace>main</namespace> <metrics> <metric.views>367</metric.views> <metric.charcount>72</metric.charcount> </metrics> <summary> <p>This page has no content. Enrich Best Wiki Ever by contributing.</p></summary> <security href="http://192.168.59.128/@api/deki/pages/21/security"> <permissions.effective> <operations mask="1343">LOGIN,BROWSE,READ,SUBSCRIBE,UPDATE,CREATE,DELETE,CHANGEPERMISSIONS</operations> </permissions.effective> <permissions.page> <operations mask="0"/> </permissions.page> <grants/> </security> <date.edited>2010-01-25T21:18:10Z</date.edited> <date.modified>2010-01-25T21:18:10Z</date.modified> <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 content-type changed to 'application/x.deki0805+xml'</description> <language/> <page.redirectedfrom/> <subpages href="http://192.168.59.128/@api/deki/pages/21/subpages"/> <outbound count="0"/> <inbound count="0"/> <aliases href="http://192.168.59.128/@api/deki/pages/21/aliases"/> <revisions count="2" href="http://192.168.59.128/@api/deki/pages/21/revisions"/> <comments count="0" href="http://192.168.59.128/@api/deki/pages/21/comments"/> <properties count="0" href="http://192.168.59.128/@api/deki/pages/21/properties"> <language deprecated="true"/> </properties> <tags count="0" href="http://192.168.59.128/@api/deki/pages/21/tags"/> <files count="0"/> <contents type="application/x.deki0805+xml" href="http://192.168.59.128/@api/deki/pages/21/contents"/> <contents.alt type="application/pdf" href="http://192.168.59.128/@api/deki/pages/21/pdf"/> </page>
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.
page id
- Note that the "home" page id is a special path and does not require a preceding equals sign (=) like "foo" does in the curl command shown above.