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

Overview

public. Post a new comment to a page

Uri Parameters
NameTypeDescription
pageidstringeither an integer page ID, "home", or "=" followed by a double uri-encoded page title
Query Parameters
NameTypeDescription
titlestring?Title for comment
Return Codes
NameValueDescription
BadRequest400Invalid input parameter or request body (must be text MIME type)
Forbidden403Update access to the page is required
NotFound404The requested page could not be found
Ok200The request completed successfully

Message Format

Input: 
Content-type=text/plain

Output:

<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> 
</comment>

Implementation Notes

Use PUT:pages/{pageid}/comments/{commentnumber}/content to update an existing comment.

Code Samples

The following code example creates a new comment on the home page:

Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
DreamMessage msg = DreamMessage.Ok(MimeType.TEXT, "Comment text");
p.At("pages", "home", "comments").Post(msg);

Sample response indicating that the comment was successfully created:

<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>
Tag page
You must login to post a comment.