Contents
On this page

Bulk Update Members - Plugixa Team

POST /plugixateam/v1/members/bulk-action

Publish, draft, feature or unfeature several members in one request.

Needs a signed-in WordPress user with the plugixa_team_edit capability, which administrators and editors get when the plugin is activated, or manage_options.

Request

POST https://your-site.example/wp-json/plugixateam/v1/members/bulk-action

Request body

Content type: application/json

Field Type Required Description
ids array Yes Member ids. Unknown ids are ignored.
action string Yes publish, draft, feature or unfeature. There is no bulk hidden: use Update Member Status for that.
{
  "action": "publish",
  "ids": [57, 58, 61]
}

Responses

200 OK. The action was applied.

{
  "success": true,
  "message": "Bulk action completed on 3 members",
  "data": {
    "affected": 3
  }
}
Field Type Meaning
data.affected integer How many members were changed

Errors

Status Code When
400 rest_error ids is missing, empty or not an array, or action is not one of the four values.
500 rest_error The database refused the change.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixateam/v1/members/bulk-action" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"action":"publish","ids":[57,58,61]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixateam/v1/members/bulk-action');
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([
        'action' => 'publish',
        'ids'    => [57, 58, 61],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = btoa(`admin:${process.env.WP_APP_PASSWORD}`);
const response = await fetch('https://your-site.example/wp-json/plugixateam/v1/members/bulk-action', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${auth}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ action: 'publish', ids: [57, 58, 61] }),
});
const { data } = await response.json();

Quick Links

Share