Contents
On this page

Create Exception - Plugixa Car Parking

POST /plugixa-car-parking/v1/locations/{id}/exceptions

Add a closure or a day with special hours to a location.

The user needs the plugixa_carparking_edit capability.

Request

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

Path parameters

Name Type Description
id integer The location’s id

Request body

Content type: application/json

Field Type Required Description
type string No closed or special. Defaults to closed.
start_date string Yes YYYY-MM-DD. Any other form counts as missing.
end_date string Yes YYYY-MM-DD, on or after start_date.
open_time string No For special. HH:MM or HH:MM:SS. Anything else is stored as null.
close_time string No For special. Same form.
note string No Plain text.
{
  "type": "special",
  "start_date": "2026-12-31",
  "end_date": "2026-12-31",
  "open_time": "08:00",
  "close_time": "14:00",
  "note": "New Year's Eve"
}

Responses

201 Created. data is the new exception.

{
  "success": true,
  "data": {
    "id": 8,
    "location_id": 4,
    "type": "special",
    "start_date": "2026-12-31",
    "end_date": "2026-12-31",
    "open_time": "08:00:00",
    "close_time": "14:00:00",
    "note": "New Year's Eve"
  }
}
Field Type Meaning
data.id integer The exception’s id
data.location_id integer The location
data.type string closed (closed all day) or special (open with other hours)
data.start_date string First date, YYYY-MM-DD
data.end_date string Last date, YYYY-MM-DD, included
data.open_time string|null For special: opening time, HH:MM:SS. null means no opening limit
data.close_time string|null For special: closing time. null means no closing limit
data.note string|null Your note

Errors

Status Code When
404 plugixa_carparking_not_found No location with that id, or it is in the trash.
422 plugixa_carparking_invalid_choice type is not closed or special.
422 plugixa_carparking_missing_dates start_date or end_date is missing or not in YYYY-MM-DD form.
422 plugixa_carparking_invalid_range end_date is before start_date.
500 plugixa_carparking_insert_failed The database refused the row.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-car-parking/v1/locations/4/exceptions" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"type":"special","start_date":"2026-12-31","end_date":"2026-12-31","open_time":"08:00","close_time":"14:00","note":"New Year'\''s Eve"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/locations/4/exceptions');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'type'       => 'special',
        'start_date' => '2026-12-31',
        'end_date'   => '2026-12-31',
        'open_time'  => '08:00',
        'close_time' => '14:00',
        'note'       => 'New Year\'s Eve',
    ]),
]);
$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/exceptions', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    type: 'special',
    start_date: '2026-12-31',
    end_date: '2026-12-31',
    open_time: '08:00',
    close_time: '14:00',
    note: 'New Year\'s Eve',
  }),
});
const { data } = await response.json();

Quick Links

Share