Contents
On this page
Reorder Groups - Plugixa Team
POST /plugixateam/v1/groups/reorder
Set the position of several groups at once.
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/groups/reorder
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
items |
array |
Yes | { "id": 3, "display_order": 0 } objects. An item missing either key is skipped, and so is an unknown id. |
To order members inside a group, use Reorder Members with group_id.
{
"items": [
{ "id": 3, "display_order": 0 },
{ "id": 5, "display_order": 1 },
{ "id": 4, "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/groups/reorder" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"items":[{"id":3,"display_order":0},{"id":5,"display_order":1},{"id":4,"display_order":2}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixateam/v1/groups/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([
'items' => [
[
'id' => 3,
'display_order' => 0,
],
[
'id' => 5,
'display_order' => 1,
],
[
'id' => 4,
'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/groups/reorder', {
method: 'POST',
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
items: [
{ id: 3, display_order: 0 },
{ id: 5, display_order: 1 },
{ id: 4, display_order: 2 },
],
}),
});
const { data } = await response.json();
Quick Links
Share