Post, read, update and delete comments on entries. Part of the Webservice module since v10.0.0, before it was a separate package for ExpressionEngine 2
WARNING
Since v10.0.0 the Comment API is part of the module. The separate Webservice Comment API package (ExpressionEngine 2 only) is discontinued (Breaking change). The Comment module of ExpressionEngine needs to be installed.
The Comment API is off by default. Enable it with Comment API in the API settings, then enable the API for a member on the member page.
The Comment API follows the rules of the comment form of ExpressionEngine, but it is an implementation of the Webservice module. After updating ExpressionEngine, check that it still works as you expect.
The ExpressionEngine permissions of the member apply, like on the site:
Endpoint
Permission
create_comment
Post comments, and the comment settings of the channel and the entry
read_comment
Open comments of the channels assigned to the member. On a public endpoint also the open comments of open entries in every channel, for guests too. Comments with another status, and the email and IP address, need Moderate comments
update_comment
The text: Edit all comments, or your own comment with Edit own comments (within the comment edit time limit). The status: Moderate comments
delete_comment
Delete all comments, or your own comment with Delete own comments
A comment is always posted as the member of the request, with its name and email. Without credentials (a public endpoint) it is posted as a guest, when the channel does not require membership.
Name
Description
entry_id
The entry
Required
comment
The comment
Required
notify_me
y to get an email of the new comments on the entry
Optional
name
The name of a guest
Required for guests
email
The email of a guest
Required for guests when the channel requires an email
url, location
The url and location of a guest
Optional
page_url
The url of the page with the comments, used in the notification emails. Default: the comment url (or url) of the channel with the url title
Optional
Like the comment form of ExpressionEngine:
comments must be allowed for the channel and the entry, and not be expired (with the comment moderation override an expired comment is moderated);
the maximum length and the banned names and emails apply; the comment time lock and the duplicate check apply, except for a Super Admin;
the comment is pending when the channel moderates comments, unless a role of the member is excluded from moderation or the member is a Super Admin;
the spam service of ExpressionEngine checks the comment when the Spam module is installed, except for a Super Admin;
the notifications of the administrators, the author and the subscribers are sent;
the hooks of ExpressionEngine are called: insert_comment_start, insert_comment_insert_array and insert_comment_end.
The API has no captcha, the rate limiting protects a public endpoint against spam.
webservice_create_comment_start (the data, the return value replaces it), webservice_create_comment_end (comment_id), webservice_read_comment_end (the comments, the return value replaces them), webservice_update_comment_end (comment_id) and webservice_delete_comment_end (comment_id).
API Comment
Post, read, update and delete comments on entries. Part of the Webservice module since v10.0.0, before it was a separate package for ExpressionEngine 2
WARNING
Since v10.0.0 the Comment API is part of the module. The separate Webservice Comment API package (ExpressionEngine 2 only) is discontinued (Breaking change). The Comment module of ExpressionEngine needs to be installed.
Enable the API
The Comment API is off by default. Enable it with Comment API in the API settings, then enable the API for a member on the member page.
The Comment API follows the rules of the comment form of ExpressionEngine, but it is an implementation of the Webservice module. After updating ExpressionEngine, check that it still works as you expect.
Endpoints
POST/webservice/commentcreate_commentGET/webservice/commentread_commentPUT/PATCH/webservice/commentupdate_commentDELETE/webservice/commentdelete_commentPermissions
The ExpressionEngine permissions of the member apply, like on the site:
create_commentread_commentopenentries in every channel, for guests too. Comments with another status, and the email and IP address, need Moderate commentsupdate_commentdelete_commentcreate_comment
A comment is always posted as the member of the request, with its name and email. Without credentials (a public endpoint) it is posted as a guest, when the channel does not require membership.
yto get an email of the new comments on the entryLike the comment form of ExpressionEngine:
insert_comment_start,insert_comment_insert_arrayandinsert_comment_end.The API has no captcha, the rate limiting protects a public endpoint against spam.
The
statusisopen,pending(moderated) orspam.read_comment
o(open, default),c(closed),p(pending),s(spam), comma separated. Other than open needs Moderate commentscomment_date(default),comment_idorentry_idasc(default) ordesc25, maximum100No results is a
200withNo comments foundand an emptydata.update_comment
open,closed,pendingorspam(oro,c,p,s)delete_comment
Errors
401403404422errorshas a message per field429501Hooks
webservice_create_comment_start(the data, the return value replaces it),webservice_create_comment_end(comment_id),webservice_read_comment_end(the comments, the return value replaces them),webservice_update_comment_end(comment_id) andwebservice_delete_comment_end(comment_id).Changes in v10.0.0
member_idis not accepted.read_commentonly returns open comments without the email and IP address, unless the member can moderate comments.search_commentis part ofread_comment.