Contents
On this page

Delete Location - Plugixa Car Parking

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

Move a location to the trash.

The user needs the plugixa_carparking_delete capability.

A location that upcoming bookings still use cannot be trashed: move or cancel those bookings first, or set the location to inactive instead. An upcoming booking is one that has not ended yet, whose status holds a space (by default pending, confirmed, paid and completed), and whose payment hold has not expired. The location’s spaces, opening hours and exceptions are left as they are.

A trashed location can be brought back, or deleted for good: see the trash.

Note. Deleting for good skips the upcoming-bookings check, but is refused for a location that any booking has ever named, trashed bookings included. That refusal comes back as 404 plugixa_carparking_not_found, not as a conflict. A location deleted for good leaves its spaces, opening hours and exceptions behind.

Request

DELETE https://your-site.example/wp-json/plugixa-car-parking/v1/locations/4

Path parameters

Name Type Description
id integer The location’s id

Responses

200 OK. The location is in the trash.

{
  "success": true,
  "data": {
    "trashed": true
  }
}

Errors

Status Code When
404 plugixa_carparking_not_found No location with that id, or it is in the trash.
409 plugixa_carparking_location_in_use Upcoming bookings still use the location. message says how many, and data.blockers lists the reasons.

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share