Contents
On this page

Update Vehicle Category - Plugixa Car Rental

PUT /plugixa-car-rental/v1/vehicle-categories/{id}

Change a vehicle category. Only the fields you send are changed; PATCH works the same way.

The user needs the plugixa_car_rental_edit capability.

Request

PUT https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-categories/2

Path parameters

Name Type Description
id integer The vehicle category’s id

Request body

Content type: application/json

Field Type Required Description
name string No Must not be blank.
description string No Plain text. Line breaks are kept, tags 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 Category.

{
  "sort_order": 5,
  "modified_at": "2026-11-12 09:30:00"
}

Responses

200 OK. data is the vehicle category as it now is.

{
  "success": true,
  "data": {
    "id": 2,
    "name": "SUV",
    "description": "High seating, room for luggage.",
    "sort_order": 5,
    "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
  }
}
Field Type Meaning
data.sort_order integer Position in lists, lowest first
data.modified_at string UTC datetime of this change

Errors

Status Code When
404 plugixa_car_rental_not_found No vehicle category with that id, or it is in the trash.
422 plugixa_car_rental_missing_name name is missing or blank.
422 plugixa_car_rental_invalid_choice status is not published or unpublished. data.allowed lists the accepted values.
422 plugixa_car_rental_not_a_number sort_order is not a number.
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 category 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-categories/2" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"sort_order":5,"modified_at":"2026-11-12 09:30:00"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-rental/v1/vehicle-categories/2');
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([
        'sort_order'  => 5,
        '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-categories/2', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${auth}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ sort_order: 5, modified_at: '2026-11-12 09:30:00' }),
});
const { data } = await response.json();

Quick Links

Share