{"id":2366,"date":"2026-10-20T08:32:19","date_gmt":"2026-10-20T07:32:19","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/post-a-review-with-the-rest-api\/"},"modified":"2026-10-20T08:40:21","modified_gmt":"2026-10-20T07:40:21","slug":"post-a-review-with-the-rest-api","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/api\/post-a-review-with-the-rest-api\/","title":{"rendered":"How to post a review with the GeoDirectory REST API"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Send a POST request to the reviews endpoint with the listing ID, the review text and a <code>rating<\/code> value. The GeoDirectory REST API must be on (GeoDirectory > Settings > API, &#8220;Enable the REST API&#8221;), and the request must be authenticated as the user writing the review.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The request<\/h2>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-bash\">POST \/wp-json\/geodir\/v2\/reviews\n\npost=123\ncontent=Great food and friendly staff.\nrating=5<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>post<\/code> is the listing ID.<\/li>\n\n\n\n<li><code>content<\/code> is the review text.<\/li>\n\n\n\n<li><code>rating<\/code> is the overall star rating as a whole number.<\/li>\n\n\n\n<li>Optional: <code>parent<\/code> to reply to another review, and <code>author_name<\/code> \/ <code>author_email<\/code> if your site requires them.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Send the values as form data or JSON in the request body. Authentication is covered in <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/api\/authentication\/\">Authentication<\/a>, and the full list of routes is in <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/api\/endpoints\/\">Endpoints<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The rating is also saved when you post to the WordPress comments route, <code>\/wp-json\/wp\/v2\/comments<\/code>, on a GeoDirectory listing, because both routes run the same rating code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Review is saved but not visible<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Reviews follow your WordPress discussion settings. If comments need approval, a review posted through the API is held as pending until you approve it under Comments in the WordPress admin. Pending reviews do not show on the listing or in recent reviews.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Listing owner gets no email<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">GeoDirectory sends the &#8220;new review&#8221; email to the listing owner when a comment is posted through the normal form. Comments created through the REST API skip that step. This snippet sends the same email for reviews created through the API:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_action( &#039;rest_insert_comment&#039;, &#039;my_gd_rest_review_notify&#039;, 20, 3 );\nfunction my_gd_rest_review_notify( $comment, $request, $creating ) {\n\tif ( $creating &amp;&amp; function_exists( &#039;geodir_new_comment_notify_postauthor&#039; ) ) {\n\t\tgeodir_new_comment_notify_postauthor( $comment-&gt;comment_ID );\n\t}\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The email is only sent when &#8220;Email me whenever anyone posts a comment&#8221; is on at Settings > Discussion and the owner email is enabled in GeoDirectory&#8217;s email settings.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Send a POST request to the reviews endpoint with the listing ID, the review text and a rating value. The GeoDirectory REST API must be on (GeoDirectory > Settings > API, &#8220;Enable the REST API&#8221;), and the request must be authenticated as the user writing the review. The request Send the values as form data [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[882,883],"class_list":["post-2366","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-api","gd_placecategory-developer-docs"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=2366"}],"version-history":[{"count":1,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2366\/revisions"}],"predecessor-version":[{"id":2427,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2366\/revisions\/2427"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2366"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2366"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}