Contents
Create Location - Plugixa Car Parking
POST /plugixa-car-parking/v1/locations
Create a location: a car park customers can book spaces at.
The user needs the plugixa_carparking_create capability.
Request
POST https://your-site.example/wp-json/plugixa-car-parking/v1/locations
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
Yes | Must not be blank. At most 255 characters. |
slug |
string |
No | Made from the name when empty. Made unique by appending -2, -3, … |
description |
string |
No | HTML. Tags not allowed in a post are stripped. |
status |
string |
No | active (the default) or inactive. |
inventory_mode |
string |
No | How spaces are counted: capacity (the default), or assigned PRO, where each space is identified on its own. |
default_billing_type |
string |
No | The billing unit: minute, hour, day (the default), week or month. |
currency |
string |
No | A currency code, at most 10 characters. Empty means the site currency. |
timezone |
string |
No | At most 64 characters. |
address_line1, address_line2 |
string |
No | At most 255 characters each. |
city, state |
string |
No | At most 120 characters each. |
postcode |
string |
No | At most 30 characters. |
country |
string |
No | Two-letter country code. |
latitude |
number |
No | From -90 to 90. Empty or null clears it. |
longitude |
number |
No | From -180 to 180. Empty or null clears it. |
phone |
string |
No | At most 50 characters. |
email |
string |
No | An address that is not valid is stored as empty. |
image_id |
integer |
No | A media library attachment id. 0 clears it. |
gallery |
integer[] |
No | Attachment ids. Zeros are dropped. |
settings |
object |
No | Flat map of option keys to plain values. Nested values are dropped. Pro modules read deposit_enable, deposit_percentage, installments_enable and installments_rolling from it. |
display_order |
integer |
No | Sort position. |
Fields not listed are ignored, including anything sent for id, the dates or the counts. Tags and line breaks are removed from the plain text fields.
{
"name": "Airport P2",
"default_billing_type": "day",
"currency": "EUR",
"city": "Lyon",
"country": "FR",
"latitude": 45.7256,
"longitude": 5.0811
}
Responses
201 Created. data is the new location.
{
"success": true,
"data": {
"id": 4,
"language_code": null,
"translation_group": null,
"name": "Airport P2",
"slug": "airport-p2",
"description": "<p>Covered parking five minutes from Terminal 2.</p>",
"status": "active",
"inventory_mode": "capacity",
"default_billing_type": "day",
"currency": "EUR",
"timezone": "Europe/Paris",
"address_line1": "12 Rue de l'Aviation",
"address_line2": null,
"city": "Lyon",
"state": null,
"postcode": "69125",
"country": "FR",
"latitude": 45.7256,
"longitude": 5.0811,
"phone": "+33 4 72 00 00 00",
"email": "p2@example.com",
"image_id": 88,
"gallery": [88, 91],
"settings": {
"deposit_enable": true,
"deposit_percentage": 20
},
"display_order": 0,
"created_by": 1,
"modified_by": 1,
"created_at": "2026-11-12 09:30:00",
"updated_at": null,
"modified_at": "2026-11-12 09:30:00",
"deleted_at": null,
"space_type_count": 2,
"forms": [
{
"id": 1,
"name": "Default booking form",
"status": "active",
"all_locations": true
}
],
"image_url": "https://your-site.example/wp-content/uploads/2026/11/airport-p2-300x200.jpg"
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The location’s id |
data.name |
string |
Display name |
data.slug |
string |
Unique among all locations, trashed ones included |
data.status |
string |
active or inactive |
data.inventory_mode |
string |
capacity, or assigned PRO |
data.default_billing_type |
string |
minute, hour, day, week or month |
data.currency |
string|null |
The location’s own currency code. When empty, prices use the site currency |
data.latitude, data.longitude |
number|null |
Map position |
data.image_id |
integer|null |
Media library attachment id |
data.gallery |
integer[]|null |
Attachment ids |
data.settings |
object|null |
Per-location options read by modules |
data.created_at, data.modified_at |
string |
UTC datetime |
data.deleted_at |
string|null |
null unless the location is in the trash |
data.space_type_count |
integer |
How many space types have an active space here |
data.forms |
object[] |
The booking forms that offer this location: id, name, status, and all_locations (true when the form offers every location) |
data.image_url |
string|null |
URL of the image at medium size, null without an image |
A new location has no opening hours and no spaces yet. Add them with Update Opening Hours and Create Space.
Errors
| Status | Code | When |
|---|---|---|
422 |
plugixa_carparking_missing_name |
name is missing or blank. |
422 |
plugixa_carparking_invalid_choice |
status, inventory_mode or default_billing_type is not one of its values. data.allowed lists them. |
422 |
plugixa_carparking_invalid_latitude |
latitude is outside -90 to 90. |
422 |
plugixa_carparking_invalid_longitude |
longitude is outside -180 to 180. |
422 |
plugixa_carparking_too_long |
A text field is longer than its column. data.field names it and data.max gives the limit. |
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" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"name":"Airport P2","default_billing_type":"day","currency":"EUR","city":"Lyon","country":"FR","latitude":45.7256,"longitude":5.0811}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/locations');
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([
'name' => 'Airport P2',
'default_billing_type' => 'day',
'currency' => 'EUR',
'city' => 'Lyon',
'country' => 'FR',
'latitude' => 45.7256,
'longitude' => 5.0811,
]),
]);
$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', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Airport P2',
default_billing_type: 'day',
currency: 'EUR',
city: 'Lyon',
country: 'FR',
latitude: 45.7256,
longitude: 5.0811,
}),
});
const { data } = await response.json();
Quick Links
Share