Contents
On this page

Delete Booking - Plugixa Car Parking

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

Move a booking to the trash. It stops counting against availability and leaves the list, and can be brought back.

The user needs the plugixa_carparking_delete capability.

Restoring and deleting for good use the trash routes every resource has. Two things are particular to bookings:

  • POST /bookings/{id}/restore checks the opening hours and the free spaces again when the booking would hold a space, and answers 409 no_availability if its dates have been taken since. Add force=true to restore it anyway.
  • DELETE /bookings/{id}/purge is refused with 409 plugixa_carparking_booking_has_payments while a completed payment is recorded against the booking. Purging also removes the booking’s price lines, its message log, its payment attempts that never completed and, with Pro, its monthly payment plan.

Request

DELETE https://your-site.example/wp-json/plugixa-car-parking/v1/bookings/57

Path parameters

Name Type Description
id integer The booking’s id

Responses

200 OK. The booking is in the trash.

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

Errors

Status Code When
404 plugixa_carparking_not_found No booking with that id, or the booking is already in the trash.

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share