Contents
On this page
Delete Space Type - Plugixa Car Parking
DELETE /plugixa-car-parking/v1/space-types/{id}
Move a space type to the trash. Its prices are kept, so it comes back whole if you restore it.
The signed-in user needs the plugixa_carparking_delete capability (trash, restore and delete records).
A space type that upcoming bookings still use cannot be trashed: move or cancel those bookings first, or set its status to inactive with Update Space Type instead. An upcoming booking is one that has not ended yet and whose status holds a space (by default pending, confirmed, paid and completed; the list is a plugin setting).
Note. Trashing a space type also removes it from every booking form that lists it. A form left with no space type at all is switched to
inactive, except the default form, which then offers every space type. Restoring the space type does not put it back on those forms.
Bring it back with POST /space-types/{id}/restore, or delete it for good with DELETE /space-types/{id}/purge, which also deletes its prices: see Trash.
Request
DELETE https://your-site.example/wp-json/plugixa-car-parking/v1/space-types/2
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The space type’s id |
Responses
200 OK. The space type 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 space type with that id, or it is already in the trash. |
409 |
plugixa_carparking_space_type_in_use |
Upcoming bookings still use it. message says how many; 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/space-types/2" \
-u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/space-types/2');
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/space-types/2', {
method: 'DELETE',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
},
});
const { data } = await response.json();
Quick Links
Share