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.
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 comment time lock, the duplicate check, the maximum length and the banned names and emails apply (not for a Super Admin);
the comment is pending when the channel moderates comments, unless a role of the member is excluded from moderation;
the spam service of ExpressionEngine checks the comment when the Spam module is installed;
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, 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).
Part of the module, for ExpressionEngine 7+, off by default (Comment API in the settings).
A comment is posted as the member of the request; member_id is not accepted.
The rules of the comment form of ExpressionEngine apply: roles and permissions, moderation, spam, notifications.
read_comment only returns open comments without the email and IP address, unless the member can moderate comments. Before, it returned all comments with the email and IP address.
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_commentupdate_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, maximum100update_comment
open,closed,pendingorspam(oro,c,p,s)delete_comment
Errors
401403404422errorshas a message per field429501Hooks
webservice_create_comment_start,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. Before, it returned all comments with the email and IP address.search_commentis part ofread_comment.