Contents
On this page
Add Member - Plugixa Car Parking
POST /plugixa-car-parking/v1/customer-groups/{id}/members
Add one WordPress user to a customer group, by user id or by e-mail address.
Needs Plugixa Car Parking Pro. The WordPress user needs the plugixa_carparking_edit capability (change records). The modified_at check of an update does not apply here.
Request
POST https://your-site.example/wp-json/plugixa-car-parking/v1/customer-groups/3/members
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The group’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
user_id |
integer |
One of the two | The WordPress user id. Wins when both are sent. |
email |
string |
One of the two | The user’s e-mail address. |
Adding a user who is already a member is not an error: nothing changes and the answer is the same. The user does not need any Plugixa Car Parking capability.
{
"email": "emma@example.com"
}
Responses
201 Created. data is all the members of the group as they now stand.
{
"success": true,
"data": [
{
"id": 25,
"name": "Lucas Bernard",
"email": "lucas@example.com"
},
{
"id": 31,
"name": "Emma Laurent",
"email": "emma@example.com"
}
]
}
| Field | Type | Meaning |
|---|---|---|
data[].id |
integer |
The WordPress user id |
data[].name |
string |
The user’s display name, or # and the id if the user no longer exists |
data[].email |
string |
The user’s e-mail, empty if the user no longer exists |
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_carparking_not_found |
No customer group with that id, or it is in the trash. |
422 |
plugixa_carparking_missing_member |
Neither user_id nor email was sent. |
404 |
plugixa_carparking_user_not_found |
No user has that id or e-mail. data.field says which was used. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-car-parking/v1/customer-groups/3/members" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"email":"emma@example.com"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/customer-groups/3/members');
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([
'email' => 'emma@example.com',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-car-parking/v1/customer-groups/3/members', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ email: 'emma@example.com' }),
});
const { data } = await response.json();
Quick Links
Share