Contents
On this page

Send Several Requests - Plugixa Testimonial

POST /plugixatestimonial/v1/requests/bulk

Create and e-mail one request per recipient, with a shared subject and message.

Administrators only: the user needs WordPress’s manage_options capability. No plugin capability opens this route.

Note. sent counts requests that were created, not e-mails that went out: a recipient whose e-mail failed is still counted as sent. failed counts only invalid addresses and database errors. There is no limit on the number of recipients.

Request

POST https://your-site.example/wp-json/plugixatestimonial/v1/requests/bulk

Request body

Content type: application/json

Field Type Required Description
recipients object[] Yes { email, name } for each recipient. name is optional.
subject string No Defaults to the Request subject setting.
message string No Plain text. Defaults to the Request message setting.
{
  "recipients": [
    {
      "email": "lucas@example.com",
      "name": "Lucas Bernard"
    },
    {
      "email": "emma@example.com",
      "name": "Emma Wilson"
    }
  ]
}

Responses

200 OK.

{
  "success": true,
  "message": "2 requests sent, 0 failed.",
  "data": {
    "sent": 2,
    "failed": 0
  }
}
Field Type Meaning
data.sent integer Requests created
data.failed integer Recipients skipped
message string A human-readable confirmation, translated to the site language

Errors

Status Code When
400 rest_error “Recipients list is required.”

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixatestimonial/v1/requests/bulk" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"recipients":[{"email":"lucas@example.com","name":"Lucas Bernard"},{"email":"emma@example.com","name":"Emma Wilson"}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixatestimonial/v1/requests/bulk');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'recipients' => [
            [
                'email' => 'lucas@example.com',
                'name'  => 'Lucas Bernard',
            ],
            [
                'email' => 'emma@example.com',
                'name'  => 'Emma Wilson',
            ],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixatestimonial/v1/requests/bulk', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ recipients: [{ email: 'lucas@example.com', name: 'Lucas Bernard' }, { email: 'emma@example.com', name: 'Emma Wilson' }] }),
});
const { data } = await response.json();

Quick Links

Share