Contents
On this page

Reorder Members - Plugixa Team

POST /plugixateam/v1/members/reorder

Set the position of several members at once, either in the overall order or inside one group.

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/reorder

Request body

Content type: application/json

Field Type Required Description
items array Yes { "id": 57, "display_order": 0 } objects. An item missing either key is skipped.
group_id integer No Set the order inside this group. Omit it, or send 0, to set each member’s overall display_order.

Each group keeps its own order, so the same member can be first in one group and last in another. Inside a group, only members already in it are affected. Ids are not checked: an unknown id is silently skipped.

{
  "group_id": 3,
  "items": [
    { "id": 57, "display_order": 0 },
    { "id": 12, "display_order": 1 },
    { "id": 31, "display_order": 2 }
  ]
}

Responses

200 OK. The order was saved.

{
  "success": true,
  "message": "Order updated successfully",
  "data": null
}
Field Type Meaning
data null Nothing is returned

Errors

Status Code When
400 rest_error items is missing, empty or not an array.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixateam/v1/members/reorder" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"group_id":3,"items":[{"id":57,"display_order":0},{"id":12,"display_order":1},{"id":31,"display_order":2}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixateam/v1/members/reorder');
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([
        'group_id' => 3,
        'items'    => [
            [
                'id'            => 57,
                'display_order' => 0,
            ],
            [
                'id'            => 12,
                'display_order' => 1,
            ],
            [
                'id'            => 31,
                'display_order' => 2,
            ],
        ],
    ]),
]);
$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/reorder', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${auth}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    group_id: 3,
    items: [
      { id: 57, display_order: 0 },
      { id: 12, display_order: 1 },
      { id: 31, display_order: 2 },
    ],
  }),
});
const { data } = await response.json();

Quick Links

Share