Create a comment
Create a comment on a given node overview page or a reply to a comment on that node.
To create a comment on the node overview page, the target type would be "nodes" and the target id would be the node id.
To reply to a comment on this node, the target type would be "comments" and the target id would be the id of the comment to reply to.
Required
A relationship object with a data key, containing the target (comments or nodes) type and a target id is required. In addition, the content attribute describing the relationship between the node and the comment is required.
Returns
Returns a JSON object with a data key containing the representation of the new comment, if the request is successful.
If the request is unsuccessful, an errors key containing information about the failure will be returned. Refer to the list of error codes to understand why this request may have failed.
Path parameters
The unique identifier of the node you want to comment on.
Request body
Example request
{
"data": {
"type": "comments",
"attributes": {
"content": "comment content"
},
"relationships": {
"target": {
"data": {
"type": "{target_type}",
"id": "{target_id}"
}
}
}
}
}Response
Success