Contents
On this page

Check Request Token - Plugixa Testimonial

GET /plugixatestimonial/v1/requests/validate-token

Check the token of a request link, and read the name and e-mail to pre-fill the submission form with.

Public: no authentication. The token is the credential: anyone holding the link can read the two pre-fill values.

Note. Checking a token past its expires_at marks the request expired.

Request

GET https://your-site.example/wp-json/plugixatestimonial/v1/requests/validate-token?token=kR7pX2mQ9vT4wY8zB3nC6dF1gH5jL0aS7eU2iO4qW9rT3yP6

Query parameters

Name Type Default Description
token string Required. The pxt_request_token value of the link: 16 to 64 letters and digits.

To link the submission to the request, send the same value as pxt_request_token to Submit Testimonial.

Responses

{
  "success": true,
  "message": "",
  "data": {
    "recipient_name": "Lucas Bernard",
    "recipient_email": "lucas@example.com",
    "token": "kR7pX2mQ9vT4wY8zB3nC6dF1gH5jL0aS7eU2iO4qW9rT3yP6"
  }
}
Field Type Meaning
data.recipient_name string Empty when the request had none
data.recipient_email string The address the request was sent to
data.token string The token you sent

Errors

Status Code When
400 rest_invalid_param token is not 16 to 64 letters and digits.
400 rest_missing_callback_param token is missing.
404 rest_error “Invalid or expired request.”: no request has this token.
410 rest_error “This testimonial has already been submitted.”, or “This request has expired.”

Plus the errors every endpoint can return.

Examples

curl -s "https://your-site.example/wp-json/plugixatestimonial/v1/requests/validate-token?token=kR7pX2mQ9vT4wY8zB3nC6dF1gH5jL0aS7eU2iO4qW9rT3yP6"
<?php
$query = http_build_query([
    'token' => 'kR7pX2mQ9vT4wY8zB3nC6dF1gH5jL0aS7eU2iO4qW9rT3yP6',
]);
$ch = curl_init('https://your-site.example/wp-json/plugixatestimonial/v1/requests/validate-token?' . $query);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const query = new URLSearchParams({ token: 'kR7pX2mQ9vT4wY8zB3nC6dF1gH5jL0aS7eU2iO4qW9rT3yP6' });
const response = await fetch(`https://your-site.example/wp-json/plugixatestimonial/v1/requests/validate-token?${query}`);
const { data } = await response.json();

Quick Links

Share