Contents
On this page

Create Space - Plugixa Car Parking

POST /plugixa-car-parking/v1/location-spaces

Add spaces of one space type to a location.

The user needs the plugixa_carparking_create capability.

A space row puts spaces of one space type at one location. At a location that counts by capacity, a row stands for quantity interchangeable spaces. At a location that identifies each space PRO, a row with is_assigned is one numbered space. To add a run of numbered spaces in one call, use Add Numbered Spaces.

Request

POST https://your-site.example/wp-json/plugixa-car-parking/v1/location-spaces

Request body

Content type: application/json

Field Type Required Description
location_id integer Yes A location that exists and is not in the trash.
space_type_id integer Yes A space type that exists and is not in the trash.
quantity integer No A number, not negative. Defaults to 1.
label string No Plain text, at most 100 characters. null clears it.
is_assigned boolean No One individually identified space PRO. Only accepted at a location whose inventory_mode identifies each space (assigned).
status string No active (the default) or inactive.
display_order integer No Sort position. Negative values become 0.
meta object No Flat map of keys to plain values. Nested values are dropped.

Note. is_assigned does not force quantity to 1: send both yourself. Nothing stops two rows from carrying the same label.

{
  "location_id": 4,
  "space_type_id": 2,
  "label": "Covered row A",
  "quantity": 40
}

Responses

201 Created. data is the new space row.

{
  "success": true,
  "data": {
    "id": 31,
    "location_id": 4,
    "space_type_id": 2,
    "label": "Covered row A",
    "quantity": 40,
    "is_assigned": false,
    "status": "active",
    "display_order": 0,
    "meta": null,
    "created_by": 1,
    "modified_by": 1,
    "created_at": "2026-11-12 09:30:00",
    "modified_at": "2026-11-12 09:30:00",
    "deleted_at": null,
    "location_name": "Airport P2",
    "space_type_name": "Standard car"
  }
}
Field Type Meaning
data.id integer The space row’s id
data.location_id integer The location
data.location_name string|null The location’s name, null when it no longer exists
data.space_type_id integer The space type
data.space_type_name string|null The space type’s name, null when it no longer exists
data.label string|null Your label, or the number of an identified space
data.quantity integer How many spaces the row stands for
data.is_assigned boolean An individually identified space PRO
data.status string active or inactive. Only active rows count towards availability
data.display_order integer Sort position
data.meta object|null Your own flat key/value data
data.created_at, data.modified_at string UTC datetime
data.deleted_at string|null null unless the row is in the trash

Errors

Status Code When
422 plugixa_carparking_invalid_location_id location_id is missing, 0, or not a live location.
422 plugixa_carparking_invalid_space_type_id space_type_id is missing, 0, or not a live space type.
422 plugixa_carparking_not_a_number quantity is not a number.
422 plugixa_carparking_negative_number quantity is negative.
422 plugixa_carparking_invalid_choice status is not active or inactive.
400 plugixa_carparking_mode_unsupported is_assigned is true but the location does not identify each space.
422 plugixa_carparking_too_long label is longer than 100 characters.
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/location-spaces" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"location_id":4,"space_type_id":2,"label":"Covered row A","quantity":40}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/location-spaces');
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([
        'location_id'   => 4,
        'space_type_id' => 2,
        'label'         => 'Covered row A',
        'quantity'      => 40,
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-car-parking/v1/location-spaces', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    location_id: 4,
    space_type_id: 2,
    label: 'Covered row A',
    quantity: 40,
  }),
});
const { data } = await response.json();

Quick Links

Share