Contents
On this page

Delete Booking - Plugixa Car Wash

DELETE /plugixa-carwash/v1/bookings/{id}

Move a booking to the trash. It can be restored. Trashing does not cancel it: a trashed booking that was confirmed keeps its status, but stops holding its bay.

Needs the plugixa_carwash_delete capability.

Request

DELETE https://your-site.example/wp-json/plugixa-carwash/v1/bookings/42

Path parameters

Name Type Description
id integer The booking’s id

Restore or delete for good

A trashed booking stays in the database and out of every list unless you ask for view=trash. Two more routes act on it, with the same plugixa_carwash_delete capability:

Method and path Answer Does
POST /plugixa-carwash/v1/bookings/{id}/restore {"restored": true} Takes it out of the trash. A booking that still holds a bay is refused with 409 plugixa_carwash_slot_taken when someone else has booked that bay at that time since. One that is not in the trash answers 404.
DELETE /plugixa-carwash/v1/bookings/{id}/purge {"purged": true} Deletes it for good, with its lines, status history and every other row that points at it. A booking with any payment recorded is kept: 409 plugixa_carwash_has_payments.

Note. purge does not need the booking to be in the trash first, and it does not apply the in-the-bay rule: a live booking without payments, even one in progress, is deleted for good at once.

Responses

200 OK. The booking is in the trash.

{
  "success": true,
  "data": {
    "trashed": true
  }
}
Field Type Meaning
data.trashed boolean Always true

Errors

Status Code When
404 plugixa_carwash_not_found No booking with that id, or it is in the trash.
409 plugixa_carwash_cannot_trash The booking is in_progress: “A booking in the bay cannot be moved to the trash. Finish or cancel it first.”

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share