Contents
On this page

Opening Hours - Plugixa Car Parking

GET /plugixa-car-parking/v1/locations/{id}/hours

Read a location’s weekly opening hours.

The user needs the plugixa_carparking_view capability.

A booking can only start and end while the location is open. On a date covered by a date exception, the exception decides instead.

Note. A weekday with no saved hours comes back as open from 09:00:00 to 18:00:00, but the booking checks treat it as open all day. Read has_hours: when it is false, no hours are saved and the location takes bookings around the clock.

Request

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

Path parameters

Name Type Description
id integer The location’s id

Responses

200 OK. data holds the week.

{
  "success": true,
  "data": {
    "location_id": 4,
    "hours": [
      {
        "day_of_week": 0,
        "open_time": "06:00:00",
        "close_time": "23:00:00",
        "is_closed": true
      },
      {
        "day_of_week": 1,
        "open_time": "06:00:00",
        "close_time": "23:00:00",
        "is_closed": false
      },
      {
        "day_of_week": 2,
        "open_time": "06:00:00",
        "close_time": "23:00:00",
        "is_closed": false
      },
      {
        "day_of_week": 3,
        "open_time": "06:00:00",
        "close_time": "23:00:00",
        "is_closed": false
      },
      {
        "day_of_week": 4,
        "open_time": "06:00:00",
        "close_time": "23:00:00",
        "is_closed": false
      },
      {
        "day_of_week": 5,
        "open_time": "06:00:00",
        "close_time": "23:00:00",
        "is_closed": false
      },
      {
        "day_of_week": 6,
        "open_time": "06:00:00",
        "close_time": "23:00:00",
        "is_closed": false
      }
    ],
    "has_hours": true
  }
}
Field Type Meaning
data.location_id integer The location
data.hours object[] Always seven rows, one per weekday, Sunday first
data.hours[].day_of_week integer 0 for Sunday to 6 for Saturday
data.hours[].open_time string Opening time, HH:MM:SS
data.hours[].close_time string Closing time, HH:MM:SS
data.hours[].is_closed boolean Closed all day
data.has_hours boolean Whether any hours are saved for the location

Errors

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

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share