Contents
On this page

Create Location - Plugixa Chauffeur

POST /plugixa-chauffeur/v1/locations

Save a place, with its address and coordinates.

Needs a signed-in user with the plugixa_chauffeur_manage capability (administrators have it after activation).

Request

POST https://your-site.example/wp-json/plugixa-chauffeur/v1/locations

Request body

Content type: application/json

Field Type Required Description
name string Yes Must not be blank.
slug string No Made from the name when empty. Made unique by appending -2, -3, …
address string No Plain text.
latitude number No Empty stores null.
longitude number No Empty stores null.
place_id string No Google Places id.
type string No Free text; the admin offers point, airport, station, hotel, port and custom. Default point.
display_order integer No Default 0.
language_code string No Language of this entry, for multilingual sites. Can only be set on create.
translation_group string No Groups the translations of one location. Can only be set on create.
{
  "name": "Paris Charles de Gaulle Airport",
  "address": "95700 Roissy-en-France, France",
  "latitude": 49.0096906,
  "longitude": 2.5479245,
  "type": "airport"
}

Responses

200 Created. data is the new location.

{
  "success": true,
  "message": "",
  "data": {
    "id": "5",
    "language_code": "",
    "translation_group": "",
    "name": "Paris Charles de Gaulle Airport",
    "slug": "paris-charles-de-gaulle-airport",
    "address": "95700 Roissy-en-France, France",
    "latitude": "49.0096906",
    "longitude": "2.5479245",
    "place_id": "",
    "type": "airport",
    "display_order": "0",
    "created_at": "2026-11-12 09:30:00"
  }
}
Field Type Meaning
data.id string The location id, as a string
data.address string Plain text
data.latitude string|null Latitude, as a string with 7 decimals
data.longitude string|null Longitude, as a string with 7 decimals
data.place_id string Google Places id, when you have one
data.type string The admin offers point, airport, station, hotel, port and custom
data.display_order string Position in lists

Ids and the columns this endpoint does not convert come back as strings, exactly as the database returns them: compare them as strings or convert them.

Errors

Status Code When
400 rest_error name is missing or blank (“Name is required.”).
500 rest_error The database refused the row.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-chauffeur/v1/locations" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"name":"Paris Charles de Gaulle Airport","address":"95700 Roissy-en-France, France","latitude":49.0096906,"longitude":2.5479245,"type":"airport"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chauffeur/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'      => 'Paris Charles de Gaulle Airport',
        'address'   => '95700 Roissy-en-France, France',
        'latitude'  => 49.0096906,
        'longitude' => 2.5479245,
        'type'      => 'airport',
    ]),
]);
$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-chauffeur/v1/locations', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${auth}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Paris Charles de Gaulle Airport',
    address: '95700 Roissy-en-France, France',
    latitude: 49.0096906,
    longitude: 2.5479245,
    type: 'airport',
  }),
});
const { data } = await response.json();

Quick Links

Share