Contents
On this page
Vote Review Helpful - Plugixa Recipe
POST /plugixa-recipe/v1/frontend/reviews/{review_id}/helpful
Toggle a helpful vote on an approved review: the first call adds the vote, the next one removes it.
Public: no sign-in needed. A signed-in caller votes once per user; a guest votes once per IP address. Helpful votes must be on (they are by default). The Reviews app must be on.
Request
POST https://your-site.example/wp-json/plugixa-recipe/v1/frontend/reviews/41/helpful
Path parameters
| Name | Type | Description |
|---|---|---|
review_id |
integer |
The review’s id |
Responses
200 OK. data is the vote as it now stands.
{
"success": true,
"message": "",
"data": {
"is_helpful": true,
"helpful_count": 3
}
}
| Field | Type | Meaning |
|---|---|---|
data.is_helpful |
boolean |
true when this call added the vote, false when it removed it |
data.helpful_count |
integer |
The review’s helpful votes now |
No body. Each IP address may vote at most 60 times an hour (fewer when the Posts per hour, per visitor setting is lower).
Errors
| Status | Code | When |
|---|---|---|
404 |
rest_error |
No approved review with that id. |
403 |
rest_error |
Helpful votes are switched off. |
429 |
rest_error |
This IP address reached its hourly limit. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-recipe/v1/frontend/reviews/41/helpful"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-recipe/v1/frontend/reviews/41/helpful');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-recipe/v1/frontend/reviews/41/helpful', {
method: 'POST',
});
const { data } = await response.json();
Quick Links
Share