Contents
On this page
Update Member Status - Plugixa Team
PATCH /plugixateam/v1/members/{id}/status
Change one member’s status without touching anything else.
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. The id is not checked: a member that does not exist answers
200too.
Request
PATCH https://your-site.example/wp-json/plugixateam/v1/members/57/status
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The member’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
status |
string |
Yes | published, draft or hidden. A hidden member stays in the admin but is not shown on the site. |
{
"status": "draft"
}
Responses
200 OK. The status was changed.
{
"success": true,
"message": "Status updated successfully",
"data": {
"id": 57,
"status": "draft"
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The id from the URL |
data.status |
string |
The new status |
Errors
| Status | Code | When |
|---|---|---|
400 |
rest_error |
status is missing or not one of the three values. |
500 |
rest_error |
The database refused the change. |
Plus the errors every endpoint can return.
Examples
curl -s -X PATCH "https://your-site.example/wp-json/plugixateam/v1/members/57/status" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"status":"draft"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixateam/v1/members/57/status');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'status' => 'draft',
]),
]);
$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/57/status', {
method: 'PATCH',
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ status: 'draft' }),
});
const { data } = await response.json();
Quick Links
Share