Published 26 January 2026, Updated 26 January 2026
POST /aircrafts/add
Purpose: create a new aircraft.
Access:
- read-write
- admin
Payload: add format above.
Additional fields:
- Join fields are not insertable unless they are real columns in the base table.
Allowed fields (from config):
registration,type,description,inactive,initial_TTSN.
Sample payload:
{
"registration": "C-GABC",
"type": "C172",
"description": "Training aircraft",
"inactive": 0,
"initial_TTSN": 1234.5
}
Response:
{
"meta": { "status": 201, "error": null },
"data": {
"id": 1,
"registration": "C-GABC"
}
}
Examples (curl):
curl -X POST https://example.com/api/v1/prod/aircrafts/add \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "X-Client: LTW-API" \
-H "Content-Type: application/json" \
-d "{\"registration\":\"C-GABC\"}"
Examples (PHP):
<?php
$url = 'https://example.com/api/v1/prod/aircrafts/add';
$payload = json_encode(['registration' => 'C-GABC']);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_TOKEN',
'X-Client: LTW-API',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
curl_close($ch);
echo $response;
Examples (Node.js):
const fetch = require('node-fetch');
async function addAircraft() {
const res = await fetch('https://example.com/api/v1/prod/aircrafts/add', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_TOKEN',
'X-Client': 'LTW-API',
'Content-Type': 'application/json',
},
body: JSON.stringify({ registration: 'C-GABC' }),
});
if (!res.ok) {
throw new Error(`HTTP ${res.status}`);
}
const data = await res.json();
console.log(data);
}
addAircraft().catch(console.error);
