REST API Comment

REST API Comment

Wordpress plugin

Install on Wordpress

App Details

If you wish to ‘Create comments’ using REST API, without exposing Administrator credentials to the Front-End application, you are at the right place. Since WordPress 4.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:

Minimum PHP version: 7.0
Minimum WordPress version: 5.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:

  1. 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
`

  1. 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.

Pricing

Starting from $0 per month.

Check Out the Restaurant Menu Widget

By Common Ninja

Restaurant MenuTry For Free!

App Info

Rating

Reviewers

No reviews

Tags

api
comment
rest
rest-api
wp

Developed By

Joaquim Domingos António

Quick & Easy

Find the Best Wordpress plugins for you

Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!

Testimonial

Testimonial plugins for Wordpress

Contact Form

Contact Form plugins for Wordpress

Maps

Maps plugins for Wordpress

Translation

Translation plugins for Wordpress

Chat

Chat plugins for Wordpress

Slider

Slider plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Contact

Contact plugins for Wordpress

Galleries

Galleries plugins for Wordpress

SEO

SEO plugins for Wordpress

Forms

Forms plugins for Wordpress

Comments

Comments plugins for Wordpress

Backup

Backup plugins for Wordpress

Privacy

Privacy plugins for Wordpress

Optimize

Optimize plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Comments

Comments plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Video Player

Video Player plugins for Wordpress

popup

popup plugins for Wordpress

SiteMap

SiteMap plugins for Wordpress

Payment

Payment plugins for Wordpress

Coming Soon

Coming Soon plugins for Wordpress

Inventory

Inventory plugins for Wordpress

Testimonials

Testimonials plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Membership

Membership plugins for Wordpress

Forms

Forms plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Sliders

Sliders plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Security

Security plugins for Wordpress

Ads

Ads plugins for Wordpress

Music Player

Music Player plugins for Wordpress

Countdown

Countdown plugins for Wordpress

Email Marketing

Email Marketing plugins for Wordpress

Membership

Membership plugins for Wordpress

Ecommerce

Ecommerce plugins for Wordpress

Customer Support

Customer Support plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Common Ninja Apps

Some of the best Common Ninja plugins for Wordpress

Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.

Restaurant Menu for Wordpress logo

Restaurant Menu

Create an online restaurant menu that organizes dishes, highlights key items, and helps visitors explore options with confidence.

Appointment Booking for Wordpress logo

Appointment Booking

Manage appointments with an appointment booking widget that lets visitors schedule easily, syncs calendars, sends reminders, and creates a smoother booking experience.

Image Hotspot for Wordpress logo

Image Hotspot

Add interactive image hotspots to your site to turn static visuals into clickable guided experiences that improve engagement.

Charts & Graphs for Wordpress logo

Charts & Graphs

Add charts and graphs to your site to present data clearly, help visitors understand insights faster, and support more confident decision making.

Quotes Carousel for Wordpress logo

Quotes Carousel

Show inspiring quotes with a quotes carousel that rotates messages, enhances design, and keeps visitors engaged.

Slide-In Panel for Wordpress logo

Slide-In Panel

Slide in panel that appears from the top or bottom to highlight offers, capture attention, and guide visitors toward more conversions.

FAQ for Wordpress logo

FAQ

Add an FAQ section to your site to answer common questions, reduce support requests, and give visitors a smoother and more confident user experience.

Comments for Wordpress logo

Comments

Add a comments system with replies, voting, and moderation to boost engagement and build an active community on your site.

Engagement Toolbox for Wordpress logo

Engagement Toolbox

Use an engagement toolbox that combines forms, galleries, chats, and interactive elements to increase visitor activity and create a more engaging user experience.

AliExpress Reviews for Wordpress logo

AliExpress Reviews

Show AliExpress reviews to build trust, improve credibility, and help visitors make confident purchase decisions that support higher sales.

Instagram Feed for Wordpress logo

Instagram Feed

Show Instagram posts in a live feed that keeps content fresh, builds social proof, and helps visitors engage with your brand.

Catalog for Wordpress logo

Catalog

Create and customize product catalogs with a catalog widget that organizes items clearly, improves browsing, and helps visitors explore your offerings easily.

More plugins

plugins You Might Like

Discover Apps By Platform

Discover the best apps for your website

WordPress
Wix
Shopify
Weebly
Webflow
Joomla
PrestaShop
Shift4Shop
WebsiteX5
MODX
Opencart
NopCommerce

Common Ninja Search Engine

The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!

Multiple platforms