Contents
On this page
Add Fleet Member - Plugixa Car Wash
POST /plugixa-carwash/v1/fleet-accounts/{id}/members
Link a customer to a company account, so their bookings can be charged to it at the company’s rate. Sending a customer already linked changes their role.
Needs Plugixa Car Wash Pro with the Fleet accounts app on, and the plugixa_carwash_edit capability.
Note. A customer belongs to one company at most. Linking a customer who is a member of another company moves them to this one.
Request
POST https://your-site.example/wp-json/plugixa-carwash/v1/fleet-accounts/6/members
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The company account’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
customer_id |
integer |
Yes | An existing customer. |
role |
string |
No | driver or manager. Anything else is driver. Defaults to driver. |
{
"customer_id": 25,
"role": "manager"
}
Responses
200 OK. data is the company’s members, by last name.
{
"success": true,
"data": [
{
"customer_id": 25,
"role": "manager",
"name": "Lucas Bernard",
"email": "lucas@example.com",
"phone": "+1 217 555 0199"
}
]
}
| Field | Type | Meaning |
|---|---|---|
data[].customer_id |
integer |
The customer |
data[].role |
string |
driver or manager |
data[].name |
string |
Their name |
data[].email |
string |
Their e-mail |
data[].phone |
string |
Their phone |
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_carwash_not_found |
No company account with that id, or it is in the trash. |
422 |
plugixa_carwash_invalid_customer |
customer_id is not an existing customer. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-carwash/v1/fleet-accounts/6/members" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"customer_id":25,"role":"manager"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-carwash/v1/fleet-accounts/6/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([
'customer_id' => 25,
'role' => 'manager',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = Buffer.from(`admin:${process.env.WP_APP_PASSWORD}`).toString('base64');
const response = await fetch('https://your-site.example/wp-json/plugixa-carwash/v1/fleet-accounts/6/members', {
method: 'POST',
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ customer_id: 25, role: 'manager' }),
});
const { data } = await response.json();
Quick Links
Share