Skip to main content
MindTouch Success Center

pages/{pageid}/files,subpages (GET) (MT4)

Overview

Retrieves a list of files and subpages for a given page

  • 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)
redirects int? If zero, do not follow page redirects.

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> 
    <subpages href="{uri}">
        <page.subpage id="{int}" href="{uri}">
            <title>{text}</title> 
            <path>{text}</path> 
        </page.subpage>
        ... 
    </subpages>
    <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>
</page>

Implementation Notes

The contents.preview element only exists if a file preview is available. Preview generation requires the file to be an image and fall within a certain size.

Files and pages in the archive are not included in the output.

C# Code Sample: Retrieve Page Files and Subpages

The following code example retrieves the files and subpages for the home page:

Sample Code

Plug p = Plug.New("http://help.mindtouch.us/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
p.At("pages", "home", "files,subpages").Get();

Sample Response from executing Code

Sample response indicating that there is one file and one subpage:

<page id="29" href="http://help.mindtouch.us/@api/deki/pages/29">
    <title>DekiWiki (Hayes)</title> 
    <path /> 
    <subpages href="http://help.mindtouch.us/@api/deki/pages/29/subpages">
        <page.subpage id="31" href="http://help.mindtouch.us/@api/deki/pages/31">
            <title>Page Title</title> 
            <path>Page_Title</path> 
        </page.subpage>
    </subpages>
    <files count="1">
        <file id="456" href="http://help.mindtouch.us/@api/deki/files/456/info">
            <filename>myfile.jpg</filename> 
            <description /> 
            <contents type="image/pjpeg" size="53112" width="476" height="480" href="http://help.mindtouch.us/@api/deki/files/456" /> 
            <contents.preview rel="thumb" type="image/pjpeg" maxwidth="160" maxheight="160" href="http://deki-hayes/@api/deki/files/456?size=thumb" /> 
            <contents.preview rel="webview" type="image/pjpeg" maxwidth="550" maxheight="550" href="http://deki-hayes/@api/deki/files/456?size=webview" /> 
            <date.created>2007-08-29T20:44:00Z</date.created> 
            <user.createdby id="1" href="http://help.mindtouch.us/@api/deki/users/1">
                <nick>Admin</nick> 
                <username>Admin</username> 
                <email>admin@mindtouch.com</email> 
            </user.createdby>
            <revisions count="2" href="http://help.mindtouch.us/@api/deki/files/456/revisions" /> 
        </file>
    </files>
</page>

Implementation notes 

Add notes about requirements or config values

Curl Code Sample: Retrieve Page Files and Subpages

The following command retrieves a list of files and subpages associates with page "foo":

Sample Code

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

Sample Response from executing Code

Page titled "Bar" has 1 file (batman.xml) and 1 subpage (path Bar/Foo)

<page id="565" href="http://192.168.59.128/@api/deki/pages/565?redirects=0">
  <uri.ui>http://192.168.59.128/Bar</uri.ui>
  <title>Bar</title>
  <path>Bar</path>
  <namespace>main</namespace>
  <subpages totalcount="1" count="1" href="http://192.168.59.128/@api/deki/pages/565/subpages">
    <page.subpage id="600" href="http://192.168.59.128/@api/deki/pages/600?redirects=0" terminal="true" subpages="false">
      <uri.ui>http://192.168.59.128/Bar/Foo</uri.ui>
      <title>Foo</title>
      <path>Bar/Foo</path>
      <namespace>main</namespace>
    </page.subpage>
  </subpages>
  <files count="1">
    <file id="70" revision="10" href="http://192.168.59.128/@api/deki/files/70/info">
      <filename>batman.xml</filename>
      <description/>
      <contents type="text/xml" size="371" href="http://192.168.59.128/@api/deki/files/70/=batman.xml"/>
      <date.created>2010-01-28T00:34:10Z</date.created>
      <user.createdby 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.createdby>
      <revisions count="2" totalcount="10" href="http://192.168.59.128/@api/deki/files/70/revisions"/>
      <page.parent id="565" href="http://192.168.59.128/@api/deki/pages/565?redirects=0">
        <uri.ui>http://192.168.59.128/Bar</uri.ui>
        <title>Bar</title>
        <path>Bar</path>
        <namespace>main</namespace>
      </page.parent>
    </file>
  </files>
</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.
  • Was this article helpful?