Contents
On this page

Delete Booking - Plugixa Car Rental

DELETE /plugixa-car-rental/v1/bookings/{id}

Move a finished booking to the trash.

The user needs the plugixa_car_rental_delete capability.

Only a completed, cancelled, no_show or expired booking can be trashed: cancel an open one first. A trashed booking can be restored, and deleted for good only from the trash and only if no payment was ever completed on it. See the trash.

Request

DELETE https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/128

Path parameters

Name Type Description
id integer The booking’s id

Responses

200 OK. The booking is in the trash.

{
  "success": true,
  "data": {
    "id": 128
  }
}
Field Type Meaning
data.id integer The booking’s id

Errors

Status Code When
404 plugixa_car_rental_not_found No booking with that id, or it is in the trash.
409 plugixa_car_rental_in_use The booking is still open: pending, confirmed, picked_up or returned.
500 plugixa_car_rental_delete_failed The database refused the change.

Plus the errors every endpoint can return.

Examples

curl -s -X DELETE "https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/128" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/128');
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/bookings/128', {
  method: 'DELETE',
  headers: {
    'Authorization': `Basic ${auth}`,
  },
});
const { data } = await response.json();

Quick Links

Share