Contents
On this page
Update Vehicle Model - Plugixa Car Rental
PUT /plugixa-car-rental/v1/vehicle-models/{id}
Change a vehicle model. Only the fields you send are changed; PATCH works the same way.
The user needs the plugixa_car_rental_edit capability.
Note. Unpublishing a model takes it off the booking form and out of staff searches at once. Bookings already made on it are kept.
Request
PUT https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-models/4
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The vehicle model’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
No | Must not be blank. |
make |
string |
No | Manufacturer. |
model |
string |
No | Model name. |
category_id |
integer |
No | An existing vehicle category, or 0 for none. |
year |
integer |
No | From 1950 to two years after the current one. 0 or empty for none. |
transmission |
string |
No | automatic or manual. |
fuel |
string |
No | petrol, diesel, hybrid, electric or lpg. |
seats |
integer |
No | 1 to 99. |
doors |
integer |
No | 0 to 9. |
bags |
integer |
No | 0 to 20. |
air_conditioning |
boolean |
No | |
mileage_limit |
integer |
No | Distance included per day, 0 to 100000. |
min_driver_age |
integer |
No | 16 to 99. |
deposit |
number |
No | Deposit held at the desk. Rounded to 2 decimals. |
image_id |
integer |
No | An image in the media library, or 0 for none. |
description |
string |
No | HTML. Tags not allowed in a post are removed. |
sort_order |
integer |
No | Position in lists, lowest first. May be negative. |
status |
string |
No | published or unpublished. |
modified_at |
string |
No | The modified_at you read. When it differs from the stored one the update is refused with 409. See Edit conflicts. |
Fields you leave out keep their stored value. A field you send is checked the same way as on Create Vehicle Model.
{
"deposit": 900,
"min_driver_age": 25,
"modified_at": "2026-11-12 09:30:00"
}
Responses
200 OK. data is the vehicle model as it now is.
{
"success": true,
"data": {
"id": 4,
"category_id": 2,
"name": "Peugeot 3008",
"make": "Peugeot",
"model": "3008",
"year": 2025,
"transmission": "automatic",
"fuel": "diesel",
"seats": 5,
"doors": 5,
"bags": 3,
"air_conditioning": true,
"mileage_limit": 300,
"min_driver_age": 25,
"deposit": 900.0,
"image_id": 51,
"description": "<p>A roomy SUV with a large boot.</p>",
"sort_order": 10,
"status": "published",
"created_by": 1,
"modified_by": 1,
"created_at": "2026-11-12 09:30:00",
"modified_at": "2026-11-12 10:15:00",
"deleted_at": null,
"category_name": "SUV",
"image_url": "https://your-site.example/wp-content/uploads/2026/11/peugeot-3008-150x150.webp",
"units_count": 3
}
}
| Field | Type | Meaning |
|---|---|---|
data.min_driver_age |
integer |
Youngest driver allowed |
data.deposit |
number |
Deposit held at the desk, not part of the price |
data.modified_at |
string |
UTC datetime of this change |
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_car_rental_not_found |
No vehicle model with that id, or it is in the trash. |
422 |
plugixa_car_rental_missing_name |
name is missing or blank. |
422 |
plugixa_car_rental_out_of_range |
A number is outside its range, or year is not a plausible model year. data.field names it. |
422 |
plugixa_car_rental_unknown_reference |
category_id is not a vehicle category, or image_id is not an image. |
422 |
plugixa_car_rental_invalid_choice |
status, transmission or fuel is not one of its values. data.allowed lists them. |
422 |
plugixa_car_rental_not_a_number |
A number field was sent as something else. data.field names it. |
422 |
plugixa_car_rental_negative_number |
A number field that cannot be negative is. data.field names it. |
422 |
plugixa_car_rental_too_long |
A text field is longer than its column. data.field names it and data.max gives the limit. |
409 |
plugixa_car_rental_conflict |
You sent modified_at and the vehicle model has been saved by someone else since. data.expected and data.current carry both values. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-models/4" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"deposit":900,"min_driver_age":25,"modified_at":"2026-11-12 09:30:00"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-models/4');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'deposit' => 900,
'min_driver_age' => 25,
'modified_at' => '2026-11-12 09:30:00',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = Buffer.from(`admin:${process.env.WP_APP_PASSWORD}`).toString('base64');
const response = await fetch('https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-models/4', {
method: 'PUT',
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ deposit: 900, min_driver_age: 25, modified_at: '2026-11-12 09:30:00' }),
});
const { data } = await response.json();
Quick Links
Share