Contents
On this page
Create Space Type - Plugixa Car Parking
POST /plugixa-car-parking/v1/space-types
Create a space type: a kind of space customers book, such as a car space or a motorbike bay.
The signed-in user needs the plugixa_carparking_create capability (create records).
Request
POST https://your-site.example/wp-json/plugixa-car-parking/v1/space-types
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
Yes | Must not be blank. Plain text. |
slug |
string |
No | Made from the name when empty. Made unique by appending -2, -3, … |
description |
string |
No | HTML. Only the tags allowed in WordPress post content are kept. |
icon |
string |
No | Plain text, at most 100 characters. |
color |
string |
No | Plain text, at most 20 characters, for example #1976d2. |
width |
number |
No | Not negative, at most 999999.99. Empty or null stores no value. |
length |
number |
No | Same rules as width. |
dimension_unit |
string |
No | At most 10 characters. Defaults to m. |
features |
object |
No | Your own key/value pairs. Keys are reduced to lowercase letters, digits, - and _; values must be strings, numbers or booleans, anything else is dropped. |
display_order |
integer |
No | Position in lists. Defaults to 0. |
status |
string |
No | active (the default) or inactive. |
A new space type has no prices. Set them with Update Space Type Prices.
{
"name": "Covered car space",
"icon": "car",
"color": "#1976d2",
"width": 2.5,
"length": 5,
"features": { "covered": true },
"display_order": 1
}
Responses
201 Created. data is the new space type.
{
"success": true,
"data": {
"id": 2,
"language_code": null,
"translation_group": null,
"name": "Covered car space",
"slug": "covered-car-space",
"description": null,
"icon": "car",
"color": "#1976d2",
"width": 2.5,
"length": 5,
"dimension_unit": "m",
"features": { "covered": true },
"display_order": 1,
"status": "active",
"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
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The new space type’s id |
data.slug |
string |
The slug actually stored, after it was made unique |
data.width, data.length |
number|null |
Dimensions, in dimension_unit |
data.features |
object|null |
The cleaned key/value pairs |
data.status |
string |
active or inactive |
data.created_by |
integer |
WordPress user id of the caller |
data.created_at |
string |
UTC datetime |
Errors
| Status | Code | When |
|---|---|---|
422 |
plugixa_carparking_missing_name |
name is missing or blank. |
422 |
plugixa_carparking_invalid_choice |
status is not active or inactive. |
422 |
plugixa_carparking_not_a_number |
width or length is not a number. |
422 |
plugixa_carparking_negative_number |
width or length is negative. |
422 |
plugixa_carparking_number_too_large |
width or length is above 999999.99. |
422 |
plugixa_carparking_too_long |
A text field is longer than its column holds. 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/space-types" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"name":"Covered car space","icon":"car","color":"#1976d2","width":2.5,"length":5,"features":{"covered":true},"display_order":1}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/space-types');
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' => 'Covered car space',
'icon' => 'car',
'color' => '#1976d2',
'width' => 2.5,
'length' => 5,
'features' => ['covered' => true],
'display_order' => 1,
]),
]);
$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', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Covered car space',
icon: 'car',
color: '#1976d2',
width: 2.5,
length: 5,
features: { covered: true },
display_order: 1,
}),
});
const { data } = await response.json();
Quick Links
Share