WordPress plugin intelligence profile

REST API Comment

REST API Comment adds in the 'Comment creation' function to the Wordpress REST API.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 5.8
Current version1.0.2
WordPress coverageTested up to WordPress 5.8
Minimum stackWP 5.5 · PHP 7.0
Directory statusactive
Last directory update7 Nov 20214y ago
Active installations10Adoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records REST API Comment version 1.0.2 as active, updated 4y ago and tested up to WordPress 5.8.

Overview

About this plugin

If you wish to ‘Create comments’ using REST API, without exposing Administrator credentials to the Front-End application, you are at the right place. 7, REST API was natively included in WordPress.

In order to ‘Create a comment’, the authentication for a user with ‘Administrator’ role is required. While this is a deliberately done for security reasons, such implementation makes it very hard for Front-End applications to implement a simple ‘Post Comment’ or ‘Reply Comment’ function.

This plugin fulfils such requirement by extending the existing WordPress REST API endpoints.

Requirements:

0

5

Installation:

Download the plugin form wordpress marketplace install it like any other WordPress plugin.

After the installation activate the plugin through the ‘Plugins’ menu in WordPress

Endpoint:

When this plugin is installed one new endpoint is added to the wp/v2 namespace.

Endpoint

HTTP Verb

Permalinks

*/wp-json/wp/v2/comments/create

POST

enabled

rest_route=/wp/v2/comments/create

POST

disabled

Usage:

  • Create a Comment

To create a comment using REST API, send a POST request to:

>

/wp-json/wp/v2/comments/create – if permalinks is enabled on your wordpress website.

Or

>

rest_route=/wp/v2/comments/create if permalinks is not enabled on your wordpress website.

With a JSON body, as shown bellow:

`Json

{

“post”: “Post ID”,

“author_name”: “Comment Author’s name”,

“author_email”: “Comment Author’s email”,

“content”: “Comment content”

}

`

The content may also be send as an object:

`Json

{

“post”: “Post ID”,

“author_name”: “Comment Author’s name”,

“author_email”: “Comment Author’s email”,

“content”: {

“raw”:”Comment content”

}

}

`

Set header to:

`

content-type: application/json

`

If successful, you should receive a response with the data of the created comment:

`Json

{

“id”: “[comment id]”,

“status”: “[comment status]”,

“message”:”[server response message]”

}

`

In response header the status code should be:

`Http

HTTP 201 Created

`

  • Reply a comment

To reply a comment you just need to add the field parent for the parent comment to the JSON body

`Json

{

“post”: “Post ID”,

“author_name”: “Comment Author’s name”,

“author_email”: “Comment Author’s email”,

“content”: “Comment content”,

“parent”:”Comment parent ID”

}

`

>

Note: Ensure the parent is a comment id that belongs to the post informed in the field post. The comment parent post id must match the post id otherwise the following error will be shown:

`Json

{

“code”: “rest_post_mismatch_parent_post_id”,

“message”: “Post ID and Parent post ID does not match”,

“data”: {

“status”: 400

}

}

`

Contact

If there is any thing to say about the plugin fill free to contact us.

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • rest api
  • comment
  • wp
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 5.8

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 5.8.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to5.8
Minimum requirementsWordPress 5.5 · PHP 7.0
Update activity7 Nov 20214y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.