Contents
On this page
Delete Vehicle Model - Plugixa Car Rental
DELETE /plugixa-car-rental/v1/vehicle-models/{id}
Move a vehicle model to the trash.
The user needs the plugixa_car_rental_delete capability.
A model cannot be trashed while cars of that model are still in the fleet, or while an upcoming or current booking uses it (a confirmed or picked-up booking, or a pending one whose hold has not run out, that has not been returned yet). Remove the cars and cancel or move those bookings first.
A trashed vehicle model can be brought back, or deleted for good: see the trash.
Request
DELETE https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-models/4
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The vehicle model’s id |
Responses
200 OK. The vehicle model is in the trash.
{
"success": true,
"data": {
"trashed": true
}
}
| Field | Type | Meaning |
|---|---|---|
data.trashed |
boolean |
Always true |
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_car_rental_not_found |
No vehicle model with that id, or it is in the trash. |
409 |
plugixa_car_rental_in_use |
Cars of this model are still in the fleet, or upcoming bookings use it. data.blockers lists each reason as a sentence. |
Plus the errors every endpoint can return.
Examples
curl -s -X DELETE "https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-models/4" \
-u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-models/4');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$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-car-rental/v1/vehicle-models/4', {
method: 'DELETE',
headers: {
'Authorization': `Basic ${auth}`,
},
});
const { data } = await response.json();
Quick Links
Share