Contents
On this page

Update Group - Plugixa Team

PUT /plugixateam/v1/groups/{id}

Replace a group’s name, slug, description and position.

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.

Note. This is a full replace, not a merge. A field you leave out is overwritten: description becomes empty, display_order becomes 0, and an omitted or empty slug is saved as an empty slug, which breaks shortcodes and blocks that select the group by slug. A second group saved without a slug then fails with 500. Always send slug: read the group first with Get Group and send every field back.

Note. The id is not checked. Updating a group that does not exist answers 200 with that id and changes nothing.

Request

PUT https://your-site.example/wp-json/plugixateam/v1/groups/3

Path parameters

Name Type Description
id integer The group’s id

Request body

Content type: application/json

Field Type Required Description
name string Yes Must not be blank.
slug string Yes, in practice Made unique by appending -1, -2, … See the note above.
description string No Plain text. Omitted means empty.
display_order integer No Omitted means 0.
{
  "name": "Leadership team",
  "slug": "leadership",
  "description": "The people who set direction.",
  "display_order": 0
}

Responses

200 OK. The group was updated.

{
  "success": true,
  "message": "Group updated successfully",
  "data": {
    "id": 3
  }
}
Field Type Meaning
data.id integer The id from the URL

Errors

Status Code When
400 rest_error Validation failed: name is missing or blank. data.errors names the field.
500 rest_error The database refused the change, for example another group already has an empty slug.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/plugixateam/v1/groups/3" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"name":"Leadership team","slug":"leadership","description":"The people who set direction.","display_order":0}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixateam/v1/groups/3');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'name'          => 'Leadership team',
        'slug'          => '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/3', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${auth}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Leadership team',
    slug: 'leadership',
    description: 'The people who set direction.',
    display_order: 0,
  }),
});
const { data } = await response.json();

Quick Links

Share