Contents
On this page

Space Type Prices - Plugixa Car Parking

GET /plugixa-car-parking/v1/space-types/{id}/prices

Read every price row of a space type: one per billing unit, site-wide or for one location.

The signed-in user needs the plugixa_carparking_view capability (read records).

How a price is used: a stay is billed in its location’s billing unit (minute, hour, day, week or month). The price is the number of units times the unit’s amount, plus the initial amount once, if there is one. A row with a location_id wins at that location over the site-wide row (location_id null) for the same unit.

Request

GET https://your-site.example/wp-json/plugixa-car-parking/v1/space-types/2/prices

Path parameters

Name Type Description
id integer The space type’s id

Responses

200 OK. data holds the space type’s price rows.

{
  "success": true,
  "data": {
    "space_type_id": 2,
    "prices": [
      { "use_type": "initial", "amount": 2, "location_id": null, "currency": null },
      { "use_type": "rental_hour", "amount": 3.5, "location_id": null, "currency": null },
      { "use_type": "rental_day", "amount": 18, "location_id": null, "currency": null },
      { "use_type": "rental_day", "amount": 22, "location_id": 4, "currency": null }
    ]
  }
}
Field Type Meaning
data.space_type_id integer The space type
data.prices[].use_type string initial (a fixed fee added once per booking), rental_minute, rental_hour, rental_day, rental_week or rental_month
data.prices[].amount number Price of one unit, or the fixed fee for initial
data.prices[].location_id integer|null The location this row applies to, null for every location
data.prices[].currency string|null Stored with the row. The price calculation does not read it

Rows come back in the order they were saved. A space type with no prices returns an empty prices list.

Errors

Status Code When
404 plugixa_carparking_not_found No space type 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/space-types/2/prices" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/space-types/2/prices');
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/space-types/2/prices', {
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
  },
});
const { data } = await response.json();

Quick Links

Share