Post a Comment to a Node

You can use this request to post a new comment to a node.


The following parameters can be used in your post a comment request:

other options: wrap, v1


Permissions & Notes:

  • You must have the Publish comment permission under Standard Roles in the Advanced Editor to post a comment to any node.
    • You must also have the Publish [node type] permission under Standard Roles in the Advanced Editor relevant to the node type you are attempting to comment on.
  • The location response header will contain the URL for the newly created comment.
  • The data describing the question to be posted can be specified both in the body of the request or as a request parameter with the same names as the fields in the body.
    • When data is sent in the body of the request, the format should match the URL extension or the value of the site's HTTP request header content-type.
    • If data values for the same field are specified both on the request body and as a request or query parameter, the value of the parameters takes precedence over the value in the body.
  • This request was added in version 1.6.3.

Sample Request

A POST post a comment request to make a comment ("Testing API. Node comment text goes here.") sent to a node (nodeId: 806) on using a human-readable Username/Password (answerhub/test123) would look like this:

-u answerhub:test123 
-H "Accept: application/json" 
-H "Content-type: application/json" 
-d '{"body":"Testing API. Node comment text goes here."}' "" -v

Expected Response

Successful Response:

  • HTTP Status 201 - Created

Community User Interface Result

You will see the comment under the question "Where do I go to learn more about Answerhub"

Click Try It! to start a request and see the response here!