Discussion is disabled by default in Plone 6.1 and later.
To enable discussion, see the Plone 6.1 upgrade guide section Discussion is a core add-on.
Discussion is a feature that allows your site visitors to comment on web pages for any content object.
Commenting can be enabled globally for specific content types and for single content objects.
When commenting is enabled on your content object, you can retrieve a list of all existing comments, add new comments, reply to existing comments, or delete a comment.
To add a new comment to a content object, send a POST request to the URL of the content object and append /@comments to the URL.
The body of the request needs to contain a JSON structure with a text attribute that contains the comment text:
curl-i-XPOSThttp://nohost/plone/front-page/@comments/-H"Accept: application/json"-H"Content-Type: application/json"--data-raw'{"text": "My comment"}'--useradmin:secret
httpie
echo'{ "text": "My comment"}'|httpPOSThttp://nohost/plone/front-page/@comments/Accept:application/jsonContent-Type:application/json-aadmin:secret
If the creation of the comment has been successful, the server will respond with a 204 No Content status and the URL of the newly created comment in the location header:
To add a direct reply to an existing comment, send a POST request to the URL of the comment
to which you want to reply.
The body of the request needs to contain a JSON structure with a text attribute that contains the comment text:
curl-i-XPOSThttp://nohost/plone/front-page/@comments/123456-H"Accept: application/json"-H"Content-Type: application/json"--data-raw'{"text": "My reply"}'--useradmin:secret
httpie
echo'{ "text": "My reply"}'|httpPOSThttp://nohost/plone/front-page/@comments/123456Accept:application/jsonContent-Type:application/json-aadmin:secret
If the creation of the comment has been successful, the server will respond with a 204 No Content status and the URL of the newly created comment in the location header:
The permission to update a comment is, by default, only granted to the creater (owner role) of the comment.
An existing comment can be updated by sending a PATCH request to the URL of the comment.
The request body needs to contain a JSON structure with at least a text attribute:
http
PATCH/plone/front-page/@comments/123456HTTP/1.1Accept:application/jsonAuthorization:Basic YWRtaW46c2VjcmV0Content-Type:application/json{"text":"My NEW comment"}
curl
curl-i-XPATCHhttp://nohost/plone/front-page/@comments/123456-H"Accept: application/json"-H"Content-Type: application/json"--data-raw'{"text": "My NEW comment"}'--useradmin:secret
httpie
echo'{ "text": "My NEW comment"}'|httpPATCHhttp://nohost/plone/front-page/@comments/123456Accept:application/jsonContent-Type:application/json-aadmin:secret
python-requests
requests.patch('http://nohost/plone/front-page/@comments/123456',headers={'Accept':'application/json','Content-Type':'application/json'},json={'text':'My NEW comment'},auth=('admin','secret'))
The server will respond with a 204 No Content response and a location header with the comment URL when the comment has been updated successfully:
Comments#
Changed in version Plone: 6.1
Discussion is disabled by default in Plone 6.1 and later. To enable discussion, see the Plone 6.1 upgrade guide section Discussion is a core add-on.
Discussion is a feature that allows your site visitors to comment on web pages for any content object.
Commenting can be enabled globally for specific content types and for single content objects.
When commenting is enabled on your content object, you can retrieve a list of all existing comments, add new comments, reply to existing comments, or delete a comment.
Listing Comments#
You can list the existing comment on a content object by sending a
GET
request to the URL of the content object and appending/@comments
:http
curl
httpie
python-requests
The server will respond with a
Status 200
and a batched list of all comments:The following fields are returned.
@id
: Link to the current endpointitems
: a list of comments for the current resourceitems_total
: the total number of comments for the resourcebatching
: batching informationThe
items
attribute returns a list of comments. Each comment provides the following fields.@id
: hyperlink to the comment@parent
: (optional) the parent commentauthor_name
: the full name of the author of this commentauthor_username
: the username of the author of this commentcomment_id
: the comment ID uniquely identifies the commentin_reply_to
: the comment ID of the parent commentcreation_date
: when the comment was placedmodification_date
: when the comment was last updatedtext
: contains amime-type
andtext
attribute with the text of the comment. Defaultmime-type
istext/plain
.user_notification
: boolean value to indicate if the author of the comment requested notifications on repliesAdding a Comment#
To add a new comment to a content object, send a
POST
request to the URL of the content object and append/@comments
to the URL. The body of the request needs to contain a JSON structure with atext
attribute that contains the comment text:http
curl
httpie
python-requests
If the creation of the comment has been successful, the server will respond with a 204 No Content status and the URL of the newly created comment in the location header:
Replying to a Comment#
To add a direct reply to an existing comment, send a
POST
request to the URL of the comment to which you want to reply. The body of the request needs to contain a JSON structure with atext
attribute that contains the comment text:http
curl
httpie
python-requests
If the creation of the comment has been successful, the server will respond with a 204 No Content status and the URL of the newly created comment in the location header:
Updating a Comment#
Note
The permission to update a comment is, by default, only granted to the creater (owner role) of the comment.
An existing comment can be updated by sending a
PATCH
request to the URL of the comment. The request body needs to contain a JSON structure with at least atext
attribute:http
curl
httpie
python-requests
The server will respond with a 204 No Content response and a location header with the comment URL when the comment has been updated successfully:
Deleting a Comment#
An existing comment can be deleted by sending a
DELETE
request to the URL of the comment.Note
Deleting a comment will, by default, also delete all existing replies to that comment.
http
curl
httpie
python-requests
When the comment has been deleted successfully, the server will respond with a 204 No Content response: