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

GET:pages/{pageid}/comments

Overview

public. Retrieve the comments on a page

Uri Parameters
NameTypeDescription
pageidstringeither an integer page ID, "home", or "=" followed by a double uri-encoded page title
Query Parameters
NameTypeDescription
filterstring?Comments to return: any, nondeleted. default: nondeleted
limitint?Number of comments to retrieve. (default: 100)
offsetint?Number of comments to skip. Default: 0
sortby{date.posted}?Sort field. Prefix value with '-' to sort descending. (default: No sorting)
Return Codes
NameValueDescription
BadRequest400Invalid input parameter or request body
Forbidden403Read access to the page is required
NotFound404The requested page could not be found
Ok200The request completed successfully

Message Format

Output:

<comments count="{int}" href="{uri}">
    <comment id="{int}" href="{uri}">
        <page.parent id="{uri}" href="{uri}">
            <title>{text}</title> 
            <path>{text}</path> 
        </page.parent>
        <user.createdby id="{int}" href="{uri}">
            <nick>{text}</nick> 
            <username>{text}</username> 
            <email>{text}</email> 
        </user.createdby>
        <date.posted>{date}</date.posted> 
        <title>{text}</title> 
        <number>{int}</number> 
        <content type="{mimetype}" href="{uri}">{text}</content> 
        <user.editedby id="{int}" href="{uri}">
            <nick>{text}</nick> 
            <username>{text}</username> 
            <email>{text}</email> 
        </user.editedby>
        <date.edited>{date}</date.edited> 
        <user.deletedby id="{int}" href="{uri}">
            <nick>{text}</nick> 
            <username>{text}</username> 
            <email>{text}</email> 
        </user.deletedby>
        <date.deleted>{date}</date.deleted> 
    </comment>
    ...
</comments>

Implementation Notes

The user.deletedby and date.deleted elements only exist if the comment has been deleted.

Use POST:pages/{pageid}/comments to add new comments to the page.

Code Samples

The following code example retrieves comments on the home page:

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

Sample response indicating that the home page has one comment:

<comments count="1" href="http://deki-hayes/@api/deki/pages/29/comments">
    <comment id="1" href="http://deki-hayes/@api/deki/pages/29/comments/1">
        <page.parent id="29" href="http://deki-hayes/@api/deki/pages/29">
            <title>DekiWiki (Hayes)</title> 
            <path /> 
        </page.parent>
        <user.createdby id="1" href="http://deki-hayes/@api/deki/users/1">
            <nick>Admin</nick> 
            <username>Admin</username> 
            <email>admin@mindtouch.com</email> 
        </user.createdby>
        <date.posted>2007-08-23T09:52:07Z</date.posted> 
        <title /> 
        <number>1</number> 
        <content type="text/plain" href="http://deki-hayes/@api/deki/pages/29/comments/1/content">Comment text</content> 
    </comment>
</comments>
Tag page
You must login to post a comment.
Powered by MindTouch Deki v.8.08