Contents
On this page
Create Group - Plugixa Team
POST /plugixateam/v1/groups
Create a group to sort members into.
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
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
Yes | Must not be blank. |
slug |
string |
No | Made from the name when empty. Made unique by appending -1, -2, … |
description |
string |
No | Plain text. Tags are stripped; line breaks are kept. |
display_order |
integer |
No | Position among the groups. Defaults to 0. |
language_code |
string |
No | With WPML or Polylang active: the group’s language. Defaults to the site’s default language. |
To put members in the group, send its id in their groups with Update Member.
{
"name": "Leadership",
"description": "The people who set direction.",
"display_order": 0
}
Responses
200 OK. The group was created.
Creating answers 200, not 201.
{
"success": true,
"message": "Group created successfully",
"data": {
"id": 3
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The new group’s id |
Errors
| Status | Code | When |
|---|---|---|
400 |
rest_missing_callback_param |
name is not in the body. |
400 |
rest_error |
Validation failed: name is blank. data.errors names the field. |
500 |
rest_error |
The database refused the row. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixateam/v1/groups" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"name":"Leadership","description":"The people who set direction.","display_order":0}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixateam/v1/groups');
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([
'name' => 'Leadership',
'description' => 'The people who set direction.',
'display_order' => 0,
]),
]);
$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', {
method: 'POST',
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Leadership',
description: 'The people who set direction.',
display_order: 0,
}),
});
const { data } = await response.json();
Quick Links
Share