Contents
On this page
Submit Review - Plugixa Recipe
POST /plugixa-recipe/v1/frontend/reviews
Post a review of a published recipe, as a visitor would from the review form.
Public, unless the site does not allow guest reviews (the default): then the caller must be signed in. The Reviews app must be on.
Note. With moderation on (the default), the review is stored as
pendingand only appears once approved. With moderation off it isapprovedat once and the recipe’s rating is worked out again.
Note. When the site does not require a rating, a review sent without one is stored with a rating of
0, and once approved that0is counted in the recipe’s average rating, pulling it down.
Request
POST https://your-site.example/wp-json/plugixa-recipe/v1/frontend/reviews
Request body
Content type: application/json, or multipart/form-data to send photos.
| Field | Type | Required | Description |
|---|---|---|---|
recipe_id |
integer |
Yes | A published recipe. |
author_name |
string |
Yes | Plain text. |
author_email |
string |
Yes | A valid e-mail address. Stored, never shown publicly. |
review_text |
string |
Yes | At least 10 characters. HTML is filtered to the tags allowed in posts. |
rating |
integer |
Yes | 1 to 5. Optional when the site does not require a rating. |
turnstile_token |
string |
No | Required when the Turnstile captcha is on for reviews. |
review_images[] |
file |
No | Multipart only, when review photos are on: JPEG, PNG or WebP, up to the upload size limit, at most the configured number (3 by default, 10 at most). |
A review from a signed-in user is stored with their user id and marked verified. The caller’s IP address is stored. Each IP address may post at most 10 reviews an hour (fewer when the Posts per hour, per visitor setting is lower), and a failed captcha counts as an attempt. When review notifications are on, the site owner is e-mailed.
{
"recipe_id": 12,
"author_name": "Lucas Bernard",
"author_email": "lucas@example.com",
"rating": 5,
"review_text": "Made these on Sunday, perfect with berries."
}
Responses
200 OK. The review is stored.
{
"success": true,
"message": "Thank you! Your review will be published after moderation.",
"data": {
"id": 42,
"status": "pending"
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The new review’s id |
data.status |
string |
pending, or approved when moderation is off |
message |
string |
Thank you for your review! when approved at once |
Settings that shape this route are in Reviews settings and Captcha.
Errors
| Status | Code | When |
|---|---|---|
400 |
rest_error |
recipe_id is missing, author_name is blank, the e-mail is not valid, the text is under 10 characters, or the rating is missing or outside 1 to 5. |
400 |
rest_error |
The captcha token is missing or was rejected. |
403 |
rest_error |
Guest reviews are off and the caller is not signed in. |
404 |
rest_error |
No published recipe with that id. |
429 |
rest_error |
This IP address reached its hourly limit. |
503 |
rest_error |
The captcha service could not be reached. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-recipe/v1/frontend/reviews" \
-H "Content-Type: application/json" \
-d '{"recipe_id":12,"author_name":"Lucas Bernard","author_email":"lucas@example.com","rating":5,"review_text":"Made these on Sunday, perfect with berries."}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-recipe/v1/frontend/reviews');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'recipe_id' => 12,
'author_name' => 'Lucas Bernard',
'author_email' => 'lucas@example.com',
'rating' => 5,
'review_text' => 'Made these on Sunday, perfect with berries.',
]),
]);
$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', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({"recipe_id": 12, "author_name": "Lucas Bernard", "author_email": "lucas@example.com", "rating": 5, "review_text": "Made these on Sunday, perfect with berries."}),
});
const { data } = await response.json();
Quick Links
Share