{"id":148633,"date":"2021-10-22T17:16:05","date_gmt":"2021-10-22T17:16:05","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/rest-api-comment\/"},"modified":"2021-11-07T18:19:21","modified_gmt":"2021-11-07T18:19:21","slug":"rest-api-comment","status":"publish","type":"plugin","link":"https:\/\/mri.wordpress.org\/plugins\/rest-api-comment\/","author":20040336,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0.2","stable_tag":"1.0.2","tested":"5.8.13","requires":"5.5","requires_php":"7.0","requires_plugins":"","header_name":"REST API Comment","header_author":"Joaquim Domingos Ant\u00f3nio","header_description":"Create comments via REST API, this plugin allows comments from mobile, desktop and other web Applications","assets_banners_color":"","last_updated":"2021-11-07 18:19:21","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"https:\/\/appsdabanda.com","rating":0,"author_block_rating":0,"active_installs":10,"downloads":1058,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","faq","changelog"],"tags":{"1.0.1":{"tag":"1.0.1","author":"joaquiminteresting","date":"2021-10-22 17:15:42"},"1.0.2":{"tag":"1.0.2","author":"joaquiminteresting","date":"2021-11-07 18:19:21"}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":2618494,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.png":{"filename":"icon-256x256.png","revision":2618494,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.1","1.0.2"],"block_files":[],"assets_screenshots":{"screenshot-1.PNG":{"filename":"screenshot-1.PNG","revision":2618494,"resolution":"1","location":"assets","locale":""}},"screenshots":{"1":"This Screenshot is a sample REST API POST request using REST API Comment."},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1556,131,2299,23853,292],"plugin_category":[44],"plugin_contributors":[204463],"plugin_business_model":[],"class_list":["post-148633","plugin","type-plugin","status-publish","hentry","plugin_tags-api","plugin_tags-comment","plugin_tags-rest","plugin_tags-rest-api","plugin_tags-wp","plugin_category-discussion-and-community","plugin_contributors-joaquiminteresting","plugin_committers-joaquiminteresting"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/rest-api-comment\/assets\/icon-128x128.png?rev=2618494","icon_2x":"https:\/\/ps.w.org\/rest-api-comment\/assets\/icon-256x256.png?rev=2618494","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/rest-api-comment\/assets\/screenshot-1.PNG?rev=2618494","caption":"This Screenshot is a sample REST API POST request using REST API Comment."}],"raw_content":"<!--section=description-->\n<p>If you wish to 'Create comments' using REST API, <em>without<\/em> 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.<\/p>\n\n<p>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.<\/p>\n\n<p>This plugin fulfils such requirement by extending the existing WordPress REST API endpoints.<\/p>\n\n<p>Requirements:<\/p>\n\n<p><strong>Minimum PHP version: 7.0<\/strong>\n<strong>Minimum Wordpress version: 5.5<\/strong><\/p>\n\n<p>Installation:<\/p>\n\n<p>Download the plugin form wordpress marketplace install it like any other WordPress plugin.\nAfter the installation activate the plugin through the 'Plugins' menu in WordPress<\/p>\n\n<p>Endpoint:<\/p>\n\n<p>When this plugin is installed one new endpoint is added to the <strong>wp\/v2<\/strong> namespace.<\/p>\n\n\n\n\n  Endpoint\n  HTTP Verb\n  Permalinks\n\n\n\n\n  *\/wp-json\/wp\/v2\/comments\/create\n  POST\n  enabled\n\n\n  *\/?rest_route=\/wp\/v2\/comments\/create\n  POST\n  disabled\n\n\n\n\n<p>Usage:<\/p>\n\n<ol>\n<li>Create a Comment<\/li>\n<\/ol>\n\n<p>To create a comment using REST API, send a <code>POST<\/code> request to:<\/p>\n\n<blockquote>\n  <p><code>\/wp-json\/wp\/v2\/comments\/create<\/code> - if permalinks is enabled on your wordpress website.<\/p>\n<\/blockquote>\n\n<p>Or<\/p>\n\n<blockquote>\n  <p><code>\/?rest_route=\/wp\/v2\/comments\/create<\/code> if permalinks is not enabled on your wordpress website.<\/p>\n<\/blockquote>\n\n<p>With a <strong>JSON body<\/strong>, as shown bellow:<\/p>\n\n<pre><code>`Json\n<\/code><\/pre>\n\n<p>{\n    \"post\": \"Post ID\",\n    \"author_name\": \"Comment Author's name\",\n    \"author_email\": \"Comment Author's email\",\n    \"content\": \"Comment content\"\n}\n    `<\/p>\n\n<p>The <strong>content<\/strong> may also be send as an object:<\/p>\n\n<pre><code>`Json\n<\/code><\/pre>\n\n<p>{\n    \"post\": \"Post ID\",\n    \"author_name\": \"Comment Author's name\",\n    \"author_email\": \"Comment Author's email\",\n    \"content\": {\n        \"raw\":\"Comment content\"\n    }\n}\n    `<\/p>\n\n<p>Set header to:<\/p>\n\n<pre><code>`\n<\/code><\/pre>\n\n<p>content-type: application\/json\n    `\nIf successful, you should receive a response with the data of the created comment:<\/p>\n\n<pre><code>`Json\n<\/code><\/pre>\n\n<p>{\n  \"id\": \"[comment id]\",\n  \"status\": \"[comment status]\",\n  \"message\":\"[server response message]\"\n}\n    `<\/p>\n\n<p>In response header the  status code should be:<\/p>\n\n<pre><code>`Http\n<\/code><\/pre>\n\n<p>HTTP 201 Created\n    `<\/p>\n\n<ol>\n<li>Reply a comment<\/li>\n<\/ol>\n\n<p>To reply a comment you just need to add the field <strong>parent<\/strong> for the parent comment to the <strong>JSON body<\/strong><\/p>\n\n<pre><code>`Json\n<\/code><\/pre>\n\n<p>{\n    \"post\": \"Post ID\",\n    \"author_name\": \"Comment Author's name\",\n    \"author_email\": \"Comment Author's email\",\n    \"content\": \"Comment content\",\n    \"parent\":\"Comment parent ID\"\n}\n    `<\/p>\n\n<blockquote>\n  <p>Note: Ensure the <strong>parent<\/strong> is a comment id that belongs to the post informed in the field <strong>post<\/strong>. The comment parent post id must match the post id otherwise the following error will be shown:<\/p>\n<\/blockquote>\n\n<pre><code>`Json\n<\/code><\/pre>\n\n<p>{\n  \"code\": \"rest_post_mismatch_parent_post_id\",\n  \"message\": \"Post ID and Parent post ID does not match\",\n  \"data\": {\n    \"status\": 400\n  }\n}\n    `<\/p>\n\n<h3>Contact<\/h3>\n\n<p>If there is any thing to say about the plugin fill free to <a href=\"mailto:&#115;&#111;&#x70;&#112;&#x6f;r&#116;&#x40;&#097;&#x70;p&#115;&#x64;&#097;&#x62;&#x61;&#110;&#x64;&#097;&#046;&#x63;&#111;&#x6d;\">contact us<\/a>.<\/p>\n\n<!--section=faq-->\n<dl>\n<dt id='why%20do%20i%20need%20rest%20api%20comment%3F'><h3>Why do I need REST API Comment?<\/h3><\/dt>\n<dd><p>If you're planning on using your WordPress news website\/blog as a Backend, and you're consuming RESTful api, you'll most probably need to <strong>Create comments<\/strong> and <strong>Reply comments<\/strong> via REST API. This is precisely what this plugin does.<\/p><\/dd>\n<dt id='is%20it%20secure%3F'><h3>Is it secure?<\/h3><\/dt>\n<dd><p>Great question! For the time being, this plugin just provides the same experience any wordpress site provides by default witch is allowing any one to comment a post requiring basic infos such as: name, email address and the content, without authentication. All security was followed based on the wordpress core code.<\/p><\/dd>\n<dt id='there%27s%20a%20bug%2C%20what%20do%20i%20do%3F'><h3>There's a bug, what do I do?<\/h3><\/dt>\n<dd><p>Please create a ticket on the <a href=\"mailto:&#115;&#111;&#x70;&#112;&#x6f;r&#116;&#x40;&#097;&#x70;p&#115;&#x64;&#097;&#x62;&#x61;&#110;&#x64;&#097;&#046;&#x63;&#111;&#x6d;\">support team<\/a> or open an issue in <a href=\"https:\/\/github.com\/JoaquimInteresting\/rest-api-comment\">github repository<\/a>. We'll get back to you as soon as possible.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.2<\/h4>\n\n<ul>\n<li>It prevents comments for posts with comment status 'closed'<\/li>\n<li>It prevents comments for posts with post status different from 'publish'<\/li>\n<li>Now it requires at least wordpress version 5.5<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Now it requires at least wordpress version 4.7<\/li>\n<li>Response was updated<\/li>\n<li>README was Updated<\/li>\n<li>Bug fixed<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial Release <\/li>\n<li>Create comment<\/li>\n<li>Reply comment<\/li>\n<\/ul>","raw_excerpt":"REST API Comment adds in the &#039;Comment creation&#039; function to the Wordpress REST API.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mri.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/148633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mri.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/mri.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/mri.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=148633"}],"author":[{"embeddable":true,"href":"https:\/\/mri.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/joaquiminteresting"}],"wp:attachment":[{"href":"https:\/\/mri.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=148633"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/mri.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=148633"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/mri.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=148633"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/mri.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=148633"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/mri.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=148633"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/mri.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=148633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}