Contents
On this page

Submit Feedback - Plugixa FAQ

POST /plugixa-faq/v1/feedback

Record a visitor’s “Was this helpful?” vote on a FAQ, with an optional comment.

Public. It needs Enable feedback on in the settings and, when Require login is on, a signed-in user (in the browser, the logged-in cookie plus a wp_rest nonce). Needs Plugixa FAQ Pro: the free build does not register this route, so it answers 404 there.

Note. Each visitor gets one vote per FAQ per cooldown (24 hours unless changed; 0 means once ever), recognised by user id, IP address or a plugixa_feedback_session cookie this endpoint sets for a year. The cooldown cut-off is computed in UTC while votes are stored in site time, so on sites ahead of UTC it lasts longer than set, and behind UTC shorter. There is no other rate limit.

Request

POST https://your-site.example/wp-json/plugixa-faq/v1/feedback

Request body

Content type: application/json

Field Type Required Description
faq_id integer Yes The FAQ. It must be published and public.
is_helpful boolean Yes true for helpful, false for not helpful.
feedback_text string No A comment. Plain text; line breaks are kept.
turnstile_token string No Required when Cloudflare Turnstile is on for feedback. See Spam protection.

Feedback must also be on for the FAQ: its own setting wins, and when it has none the category’s setting applies. The vote adds one to the FAQ’s helpful_count or not_helpful_count. See Feedback widget.

{
  "faq_id": 42,
  "is_helpful": false,
  "feedback_text": "The delivery times for islands are missing."
}

Responses

200 OK. data.id is the stored vote.

{
  "success": true,
  "message": "Thank you for your feedback!",
  "data": {
    "id": 311
  }
}
Field Type Meaning
data.id integer The vote’s id
message string The thank-you message from the settings

Errors

Status Code When
403 rest_forbidden Feedback is off in the settings, login is required and the visitor is signed out, or the plugixa_faq_feedback_permission filter refused.
403 rest_error “Spam protection check failed”: the Turnstile token is missing or invalid.
404 rest_error No published, public FAQ with that id.
403 rest_error “Feedback is disabled for this FAQ”.
409 rest_error This visitor already voted on this FAQ within the cooldown.
400 rest_missing_callback_param faq_id or is_helpful is missing.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-faq/v1/feedback" \
  -H "Content-Type: application/json" \
  -d '{"faq_id":42,"is_helpful":false,"feedback_text":"The delivery times for islands are missing."}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/feedback');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'faq_id'        => 42,
        'is_helpful'    => false,
        'feedback_text' => 'The delivery times for islands are missing.',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-faq/v1/feedback', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ faq_id: 42, is_helpful: false, feedback_text: 'The delivery times for islands are missing.' }),
});
const { data } = await response.json();

Quick Links

Share