Direct Airline Booking
curl --request POST \
--url https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"bookingReference": "BK-2025-001234",
"shipper": {
"name": "<string>",
"address": "<string>",
"contact": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
}
},
"consignee": {
"name": "<string>",
"address": "<string>",
"contact": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
}
},
"routing": {
"origin": "SIN",
"destination": "LHR",
"segments": [
{
"carrier": "SQ",
"flightNumber": "SQ308",
"departureDate": "2025-01-15",
"from": "SIN",
"to": "LHR",
"allotmentCode": "FREE_SALE"
}
]
},
"cargo": {
"pieces": 10,
"grossWeightKg": 250.5,
"chargeableWeightKg": 300,
"volumeCbm": 1.5,
"commodity": {
"code": "GEN",
"description": "Electronics Equipment"
},
"specialHandling": [
"ELI",
"VAL"
],
"dimensions": [
{
"pieces": 10,
"length": 100,
"width": 50,
"height": 30,
"unit": "CM"
}
]
},
"quoteId": "QT-789",
"awb": {
"prefix": "157",
"number": "12345678"
},
"serviceLevel": "PRIORITY",
"bookingAgent": {
"code": "ACA-123",
"name": "Premium Cargo Agent"
},
"paymentTerms": "PREPAID",
"remarks": "Handle with care - fragile electronics"
}
'import requests
url = "https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings"
payload = {
"bookingReference": "BK-2025-001234",
"shipper": {
"name": "<string>",
"address": "<string>",
"contact": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
}
},
"consignee": {
"name": "<string>",
"address": "<string>",
"contact": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
}
},
"routing": {
"origin": "SIN",
"destination": "LHR",
"segments": [
{
"carrier": "SQ",
"flightNumber": "SQ308",
"departureDate": "2025-01-15",
"from": "SIN",
"to": "LHR",
"allotmentCode": "FREE_SALE"
}
]
},
"cargo": {
"pieces": 10,
"grossWeightKg": 250.5,
"chargeableWeightKg": 300,
"volumeCbm": 1.5,
"commodity": {
"code": "GEN",
"description": "Electronics Equipment"
},
"specialHandling": ["ELI", "VAL"],
"dimensions": [
{
"pieces": 10,
"length": 100,
"width": 50,
"height": 30,
"unit": "CM"
}
]
},
"quoteId": "QT-789",
"awb": {
"prefix": "157",
"number": "12345678"
},
"serviceLevel": "PRIORITY",
"bookingAgent": {
"code": "ACA-123",
"name": "Premium Cargo Agent"
},
"paymentTerms": "PREPAID",
"remarks": "Handle with care - fragile electronics"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
bookingReference: 'BK-2025-001234',
shipper: {
name: '<string>',
address: '<string>',
contact: {name: '<string>', phone: '<string>', email: 'jsmith@example.com'}
},
consignee: {
name: '<string>',
address: '<string>',
contact: {name: '<string>', phone: '<string>', email: 'jsmith@example.com'}
},
routing: {
origin: 'SIN',
destination: 'LHR',
segments: [
{
carrier: 'SQ',
flightNumber: 'SQ308',
departureDate: '2025-01-15',
from: 'SIN',
to: 'LHR',
allotmentCode: 'FREE_SALE'
}
]
},
cargo: {
pieces: 10,
grossWeightKg: 250.5,
chargeableWeightKg: 300,
volumeCbm: 1.5,
commodity: {code: 'GEN', description: 'Electronics Equipment'},
specialHandling: ['ELI', 'VAL'],
dimensions: [{pieces: 10, length: 100, width: 50, height: 30, unit: 'CM'}]
},
quoteId: 'QT-789',
awb: {prefix: '157', number: '12345678'},
serviceLevel: 'PRIORITY',
bookingAgent: {code: 'ACA-123', name: 'Premium Cargo Agent'},
paymentTerms: 'PREPAID',
remarks: 'Handle with care - fragile electronics'
})
};
fetch('https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'bookingReference' => 'BK-2025-001234',
'shipper' => [
'name' => '<string>',
'address' => '<string>',
'contact' => [
'name' => '<string>',
'phone' => '<string>',
'email' => 'jsmith@example.com'
]
],
'consignee' => [
'name' => '<string>',
'address' => '<string>',
'contact' => [
'name' => '<string>',
'phone' => '<string>',
'email' => 'jsmith@example.com'
]
],
'routing' => [
'origin' => 'SIN',
'destination' => 'LHR',
'segments' => [
[
'carrier' => 'SQ',
'flightNumber' => 'SQ308',
'departureDate' => '2025-01-15',
'from' => 'SIN',
'to' => 'LHR',
'allotmentCode' => 'FREE_SALE'
]
]
],
'cargo' => [
'pieces' => 10,
'grossWeightKg' => 250.5,
'chargeableWeightKg' => 300,
'volumeCbm' => 1.5,
'commodity' => [
'code' => 'GEN',
'description' => 'Electronics Equipment'
],
'specialHandling' => [
'ELI',
'VAL'
],
'dimensions' => [
[
'pieces' => 10,
'length' => 100,
'width' => 50,
'height' => 30,
'unit' => 'CM'
]
]
],
'quoteId' => 'QT-789',
'awb' => [
'prefix' => '157',
'number' => '12345678'
],
'serviceLevel' => 'PRIORITY',
'bookingAgent' => [
'code' => 'ACA-123',
'name' => 'Premium Cargo Agent'
],
'paymentTerms' => 'PREPAID',
'remarks' => 'Handle with care - fragile electronics'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings"
payload := strings.NewReader("{\n \"bookingReference\": \"BK-2025-001234\",\n \"shipper\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"consignee\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"routing\": {\n \"origin\": \"SIN\",\n \"destination\": \"LHR\",\n \"segments\": [\n {\n \"carrier\": \"SQ\",\n \"flightNumber\": \"SQ308\",\n \"departureDate\": \"2025-01-15\",\n \"from\": \"SIN\",\n \"to\": \"LHR\",\n \"allotmentCode\": \"FREE_SALE\"\n }\n ]\n },\n \"cargo\": {\n \"pieces\": 10,\n \"grossWeightKg\": 250.5,\n \"chargeableWeightKg\": 300,\n \"volumeCbm\": 1.5,\n \"commodity\": {\n \"code\": \"GEN\",\n \"description\": \"Electronics Equipment\"\n },\n \"specialHandling\": [\n \"ELI\",\n \"VAL\"\n ],\n \"dimensions\": [\n {\n \"pieces\": 10,\n \"length\": 100,\n \"width\": 50,\n \"height\": 30,\n \"unit\": \"CM\"\n }\n ]\n },\n \"quoteId\": \"QT-789\",\n \"awb\": {\n \"prefix\": \"157\",\n \"number\": \"12345678\"\n },\n \"serviceLevel\": \"PRIORITY\",\n \"bookingAgent\": {\n \"code\": \"ACA-123\",\n \"name\": \"Premium Cargo Agent\"\n },\n \"paymentTerms\": \"PREPAID\",\n \"remarks\": \"Handle with care - fragile electronics\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"bookingReference\": \"BK-2025-001234\",\n \"shipper\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"consignee\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"routing\": {\n \"origin\": \"SIN\",\n \"destination\": \"LHR\",\n \"segments\": [\n {\n \"carrier\": \"SQ\",\n \"flightNumber\": \"SQ308\",\n \"departureDate\": \"2025-01-15\",\n \"from\": \"SIN\",\n \"to\": \"LHR\",\n \"allotmentCode\": \"FREE_SALE\"\n }\n ]\n },\n \"cargo\": {\n \"pieces\": 10,\n \"grossWeightKg\": 250.5,\n \"chargeableWeightKg\": 300,\n \"volumeCbm\": 1.5,\n \"commodity\": {\n \"code\": \"GEN\",\n \"description\": \"Electronics Equipment\"\n },\n \"specialHandling\": [\n \"ELI\",\n \"VAL\"\n ],\n \"dimensions\": [\n {\n \"pieces\": 10,\n \"length\": 100,\n \"width\": 50,\n \"height\": 30,\n \"unit\": \"CM\"\n }\n ]\n },\n \"quoteId\": \"QT-789\",\n \"awb\": {\n \"prefix\": \"157\",\n \"number\": \"12345678\"\n },\n \"serviceLevel\": \"PRIORITY\",\n \"bookingAgent\": {\n \"code\": \"ACA-123\",\n \"name\": \"Premium Cargo Agent\"\n },\n \"paymentTerms\": \"PREPAID\",\n \"remarks\": \"Handle with care - fragile electronics\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bookingReference\": \"BK-2025-001234\",\n \"shipper\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"consignee\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"routing\": {\n \"origin\": \"SIN\",\n \"destination\": \"LHR\",\n \"segments\": [\n {\n \"carrier\": \"SQ\",\n \"flightNumber\": \"SQ308\",\n \"departureDate\": \"2025-01-15\",\n \"from\": \"SIN\",\n \"to\": \"LHR\",\n \"allotmentCode\": \"FREE_SALE\"\n }\n ]\n },\n \"cargo\": {\n \"pieces\": 10,\n \"grossWeightKg\": 250.5,\n \"chargeableWeightKg\": 300,\n \"volumeCbm\": 1.5,\n \"commodity\": {\n \"code\": \"GEN\",\n \"description\": \"Electronics Equipment\"\n },\n \"specialHandling\": [\n \"ELI\",\n \"VAL\"\n ],\n \"dimensions\": [\n {\n \"pieces\": 10,\n \"length\": 100,\n \"width\": 50,\n \"height\": 30,\n \"unit\": \"CM\"\n }\n ]\n },\n \"quoteId\": \"QT-789\",\n \"awb\": {\n \"prefix\": \"157\",\n \"number\": \"12345678\"\n },\n \"serviceLevel\": \"PRIORITY\",\n \"bookingAgent\": {\n \"code\": \"ACA-123\",\n \"name\": \"Premium Cargo Agent\"\n },\n \"paymentTerms\": \"PREPAID\",\n \"remarks\": \"Handle with care - fragile electronics\"\n}"
response = http.request(request)
puts response.read_body{
"bookingId": "AL-BK-2025-987654",
"status": "CONFIRMED",
"airlineConfirmationNumber": "SQ-CONF-123456",
"flightDetails": {
"flightNumber": "SQ308",
"departureDateTime": "2025-01-15T23:30:00Z",
"arrivalDateTime": "2025-01-16T05:45:00Z",
"capacity": {
"allocated": 300,
"unit": "KG"
}
},
"message": "Booking confirmed with airline"
}Bookings
Direct Airline Booking
Create a direct booking with a specific airline system. This API facilitates direct digital booking between ACS and airline systems without intermediate steps.
POST
/
api
/
airlines
/
{airlineCode}
/
bookings
Direct Airline Booking
curl --request POST \
--url https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"bookingReference": "BK-2025-001234",
"shipper": {
"name": "<string>",
"address": "<string>",
"contact": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
}
},
"consignee": {
"name": "<string>",
"address": "<string>",
"contact": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
}
},
"routing": {
"origin": "SIN",
"destination": "LHR",
"segments": [
{
"carrier": "SQ",
"flightNumber": "SQ308",
"departureDate": "2025-01-15",
"from": "SIN",
"to": "LHR",
"allotmentCode": "FREE_SALE"
}
]
},
"cargo": {
"pieces": 10,
"grossWeightKg": 250.5,
"chargeableWeightKg": 300,
"volumeCbm": 1.5,
"commodity": {
"code": "GEN",
"description": "Electronics Equipment"
},
"specialHandling": [
"ELI",
"VAL"
],
"dimensions": [
{
"pieces": 10,
"length": 100,
"width": 50,
"height": 30,
"unit": "CM"
}
]
},
"quoteId": "QT-789",
"awb": {
"prefix": "157",
"number": "12345678"
},
"serviceLevel": "PRIORITY",
"bookingAgent": {
"code": "ACA-123",
"name": "Premium Cargo Agent"
},
"paymentTerms": "PREPAID",
"remarks": "Handle with care - fragile electronics"
}
'import requests
url = "https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings"
payload = {
"bookingReference": "BK-2025-001234",
"shipper": {
"name": "<string>",
"address": "<string>",
"contact": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
}
},
"consignee": {
"name": "<string>",
"address": "<string>",
"contact": {
"name": "<string>",
"phone": "<string>",
"email": "jsmith@example.com"
}
},
"routing": {
"origin": "SIN",
"destination": "LHR",
"segments": [
{
"carrier": "SQ",
"flightNumber": "SQ308",
"departureDate": "2025-01-15",
"from": "SIN",
"to": "LHR",
"allotmentCode": "FREE_SALE"
}
]
},
"cargo": {
"pieces": 10,
"grossWeightKg": 250.5,
"chargeableWeightKg": 300,
"volumeCbm": 1.5,
"commodity": {
"code": "GEN",
"description": "Electronics Equipment"
},
"specialHandling": ["ELI", "VAL"],
"dimensions": [
{
"pieces": 10,
"length": 100,
"width": 50,
"height": 30,
"unit": "CM"
}
]
},
"quoteId": "QT-789",
"awb": {
"prefix": "157",
"number": "12345678"
},
"serviceLevel": "PRIORITY",
"bookingAgent": {
"code": "ACA-123",
"name": "Premium Cargo Agent"
},
"paymentTerms": "PREPAID",
"remarks": "Handle with care - fragile electronics"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
bookingReference: 'BK-2025-001234',
shipper: {
name: '<string>',
address: '<string>',
contact: {name: '<string>', phone: '<string>', email: 'jsmith@example.com'}
},
consignee: {
name: '<string>',
address: '<string>',
contact: {name: '<string>', phone: '<string>', email: 'jsmith@example.com'}
},
routing: {
origin: 'SIN',
destination: 'LHR',
segments: [
{
carrier: 'SQ',
flightNumber: 'SQ308',
departureDate: '2025-01-15',
from: 'SIN',
to: 'LHR',
allotmentCode: 'FREE_SALE'
}
]
},
cargo: {
pieces: 10,
grossWeightKg: 250.5,
chargeableWeightKg: 300,
volumeCbm: 1.5,
commodity: {code: 'GEN', description: 'Electronics Equipment'},
specialHandling: ['ELI', 'VAL'],
dimensions: [{pieces: 10, length: 100, width: 50, height: 30, unit: 'CM'}]
},
quoteId: 'QT-789',
awb: {prefix: '157', number: '12345678'},
serviceLevel: 'PRIORITY',
bookingAgent: {code: 'ACA-123', name: 'Premium Cargo Agent'},
paymentTerms: 'PREPAID',
remarks: 'Handle with care - fragile electronics'
})
};
fetch('https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'bookingReference' => 'BK-2025-001234',
'shipper' => [
'name' => '<string>',
'address' => '<string>',
'contact' => [
'name' => '<string>',
'phone' => '<string>',
'email' => 'jsmith@example.com'
]
],
'consignee' => [
'name' => '<string>',
'address' => '<string>',
'contact' => [
'name' => '<string>',
'phone' => '<string>',
'email' => 'jsmith@example.com'
]
],
'routing' => [
'origin' => 'SIN',
'destination' => 'LHR',
'segments' => [
[
'carrier' => 'SQ',
'flightNumber' => 'SQ308',
'departureDate' => '2025-01-15',
'from' => 'SIN',
'to' => 'LHR',
'allotmentCode' => 'FREE_SALE'
]
]
],
'cargo' => [
'pieces' => 10,
'grossWeightKg' => 250.5,
'chargeableWeightKg' => 300,
'volumeCbm' => 1.5,
'commodity' => [
'code' => 'GEN',
'description' => 'Electronics Equipment'
],
'specialHandling' => [
'ELI',
'VAL'
],
'dimensions' => [
[
'pieces' => 10,
'length' => 100,
'width' => 50,
'height' => 30,
'unit' => 'CM'
]
]
],
'quoteId' => 'QT-789',
'awb' => [
'prefix' => '157',
'number' => '12345678'
],
'serviceLevel' => 'PRIORITY',
'bookingAgent' => [
'code' => 'ACA-123',
'name' => 'Premium Cargo Agent'
],
'paymentTerms' => 'PREPAID',
'remarks' => 'Handle with care - fragile electronics'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings"
payload := strings.NewReader("{\n \"bookingReference\": \"BK-2025-001234\",\n \"shipper\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"consignee\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"routing\": {\n \"origin\": \"SIN\",\n \"destination\": \"LHR\",\n \"segments\": [\n {\n \"carrier\": \"SQ\",\n \"flightNumber\": \"SQ308\",\n \"departureDate\": \"2025-01-15\",\n \"from\": \"SIN\",\n \"to\": \"LHR\",\n \"allotmentCode\": \"FREE_SALE\"\n }\n ]\n },\n \"cargo\": {\n \"pieces\": 10,\n \"grossWeightKg\": 250.5,\n \"chargeableWeightKg\": 300,\n \"volumeCbm\": 1.5,\n \"commodity\": {\n \"code\": \"GEN\",\n \"description\": \"Electronics Equipment\"\n },\n \"specialHandling\": [\n \"ELI\",\n \"VAL\"\n ],\n \"dimensions\": [\n {\n \"pieces\": 10,\n \"length\": 100,\n \"width\": 50,\n \"height\": 30,\n \"unit\": \"CM\"\n }\n ]\n },\n \"quoteId\": \"QT-789\",\n \"awb\": {\n \"prefix\": \"157\",\n \"number\": \"12345678\"\n },\n \"serviceLevel\": \"PRIORITY\",\n \"bookingAgent\": {\n \"code\": \"ACA-123\",\n \"name\": \"Premium Cargo Agent\"\n },\n \"paymentTerms\": \"PREPAID\",\n \"remarks\": \"Handle with care - fragile electronics\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"bookingReference\": \"BK-2025-001234\",\n \"shipper\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"consignee\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"routing\": {\n \"origin\": \"SIN\",\n \"destination\": \"LHR\",\n \"segments\": [\n {\n \"carrier\": \"SQ\",\n \"flightNumber\": \"SQ308\",\n \"departureDate\": \"2025-01-15\",\n \"from\": \"SIN\",\n \"to\": \"LHR\",\n \"allotmentCode\": \"FREE_SALE\"\n }\n ]\n },\n \"cargo\": {\n \"pieces\": 10,\n \"grossWeightKg\": 250.5,\n \"chargeableWeightKg\": 300,\n \"volumeCbm\": 1.5,\n \"commodity\": {\n \"code\": \"GEN\",\n \"description\": \"Electronics Equipment\"\n },\n \"specialHandling\": [\n \"ELI\",\n \"VAL\"\n ],\n \"dimensions\": [\n {\n \"pieces\": 10,\n \"length\": 100,\n \"width\": 50,\n \"height\": 30,\n \"unit\": \"CM\"\n }\n ]\n },\n \"quoteId\": \"QT-789\",\n \"awb\": {\n \"prefix\": \"157\",\n \"number\": \"12345678\"\n },\n \"serviceLevel\": \"PRIORITY\",\n \"bookingAgent\": {\n \"code\": \"ACA-123\",\n \"name\": \"Premium Cargo Agent\"\n },\n \"paymentTerms\": \"PREPAID\",\n \"remarks\": \"Handle with care - fragile electronics\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://1a557de0-701c-477d-bedd-433520441dae.mock.pstmn.io/api/airlines/{airlineCode}/bookings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bookingReference\": \"BK-2025-001234\",\n \"shipper\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"consignee\": {\n \"name\": \"<string>\",\n \"address\": \"<string>\",\n \"contact\": {\n \"name\": \"<string>\",\n \"phone\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n }\n },\n \"routing\": {\n \"origin\": \"SIN\",\n \"destination\": \"LHR\",\n \"segments\": [\n {\n \"carrier\": \"SQ\",\n \"flightNumber\": \"SQ308\",\n \"departureDate\": \"2025-01-15\",\n \"from\": \"SIN\",\n \"to\": \"LHR\",\n \"allotmentCode\": \"FREE_SALE\"\n }\n ]\n },\n \"cargo\": {\n \"pieces\": 10,\n \"grossWeightKg\": 250.5,\n \"chargeableWeightKg\": 300,\n \"volumeCbm\": 1.5,\n \"commodity\": {\n \"code\": \"GEN\",\n \"description\": \"Electronics Equipment\"\n },\n \"specialHandling\": [\n \"ELI\",\n \"VAL\"\n ],\n \"dimensions\": [\n {\n \"pieces\": 10,\n \"length\": 100,\n \"width\": 50,\n \"height\": 30,\n \"unit\": \"CM\"\n }\n ]\n },\n \"quoteId\": \"QT-789\",\n \"awb\": {\n \"prefix\": \"157\",\n \"number\": \"12345678\"\n },\n \"serviceLevel\": \"PRIORITY\",\n \"bookingAgent\": {\n \"code\": \"ACA-123\",\n \"name\": \"Premium Cargo Agent\"\n },\n \"paymentTerms\": \"PREPAID\",\n \"remarks\": \"Handle with care - fragile electronics\"\n}"
response = http.request(request)
puts response.read_body{
"bookingId": "AL-BK-2025-987654",
"status": "CONFIRMED",
"airlineConfirmationNumber": "SQ-CONF-123456",
"flightDetails": {
"flightNumber": "SQ308",
"departureDateTime": "2025-01-15T23:30:00Z",
"arrivalDateTime": "2025-01-16T05:45:00Z",
"capacity": {
"allocated": 300,
"unit": "KG"
}
},
"message": "Booking confirmed with airline"
}Reference Documentation
For more information on direct airline bookings, please refer to:
- Page 21 of “Functional_Requirements_V18 FINAL”: https://belli.sg/4obmxJa
Authorizations
ApiKeyAuthApiKeyHeader
Path Parameters
Airline code (IATA)
Body
application/json
Example:
"BK-2025-001234"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Example:
"QT-789"
Show child attributes
Show child attributes
Example:
"PRIORITY"
Show child attributes
Show child attributes
Example:
"PREPAID"
Example:
"Handle with care - fragile electronics"
⌘I