I am trying to send the json data to Amadeus and I keep on getting The requested URL returned error: 400 Bad Request
. It was working properly yesterday, and today I was doing the testing with new data but keeps on getting the error message. I tried on Amadeus website and Postman, none of them work and getting the same message. On Postman, I get the details message saying: could not sell the segment 1 as in the code below:-
{
"errors": [
{
"status": 400,
"code": 34651,
"title": "SEGMENT SELL FAILURE",
"detail": "Could not sell segment 1",
"source": {
"pointer": "/data/flightOffers[0]/itineraries[0]/segments[0]"
}
}
]
}
I thought I may have run out of the allowance Amadeus provide on test environment and upon checking I have only used 196/10000. So, even this can't be the problem.
The data that I am sending to Amadeus is through curl request please find the code below:-
{
"data": {
"type": "flight-order",
"flightOffers": [
{
"type": "flight-offer",
"id": "4",
"source": "GDS",
"instantTicketingRequired": false,
"nonHomogeneous": false,
"paymentCardRequired": false,
"lastTicketingDate": "2023-07-31",
"itineraries": [
{
"segments": [
{
"departure": {
"iataCode": "MEL",
"terminal": "2",
"at": "2023-11-01T21:40:00"
},
"arrival": {
"iataCode": "AUH",
"terminal": "3",
"at": "2023-11-02T05:05:00"
},
"carrierCode": "EY",
"number": "461",
"aircraft": {
"code": "77W"
},
"operating": {
"carrierCode": "EY"
},
"duration": "PT14H25M",
"id": "5",
"numberOfStops": 0,
"co2Emissions": [
{
"weight": 630,
"weightUnit": "KG",
"cabin": "ECONOMY"
}
]
},
{
"departure": {
"iataCode": "AUH",
"terminal": "3",
"at": "2023-11-02T08:20:00"
},
"arrival": {
"iataCode": "LHR",
"terminal": "4",
"at": "2023-11-02T12:00:00"
},
"carrierCode": "EY",
"number": "19",
"aircraft": {
"code": "388"
},
"operating": {
"carrierCode": "EY"
},
"duration": "PT7H40M",
"id": "6",
"numberOfStops": 0,
"co2Emissions": [
{
"weight": 324,
"weightUnit": "KG",
"cabin": "ECONOMY"
}
]
}
]
},
{
"segments": [
{
"departure": {
"iataCode": "LHR",
"terminal": "4",
"at": "2023-11-30T21:05:00"
},
"arrival": {
"iataCode": "AUH",
"terminal": "3",
"at": "2023-12-01T07:50:00"
},
"carrierCode": "EY",
"number": "18",
"aircraft": {
"code": "388"
},
"operating": {
"carrierCode": "EY"
},
"duration": "PT6H45M",
"id": "63",
"numberOfStops": 0,
"co2Emissions": [
{
"weight": 324,
"weightUnit": "KG",
"cabin": "ECONOMY"
}
]
},
{
"departure": {
"iataCode": "AUH",
"terminal": "3",
"at": "2023-12-01T09:30:00"
},
"arrival": {
"iataCode": "MEL",
"terminal": "2",
"at": "2023-12-02T06:00:00"
},
"carrierCode": "EY",
"number": "462",
"aircraft": {
"code": "77W"
},
"operating": {
"carrierCode": "EY"
},
"duration": "PT13H30M",
"id": "64",
"numberOfStops": 0,
"co2Emissions": [
{
"weight": 630,
"weightUnit": "KG",
"cabin": "ECONOMY"
}
]
}
]
}
],
"price": {
"currency": "AUD",
"total": "1653.58",
"base": "1218.00",
"fees": [
{
"amount": "0.00",
"type": "SUPPLIER"
},
{
"amount": "0.00",
"type": "TICKETING"
},
{
"amount": "0.00",
"type": "FORM_OF_PAYMENT"
}
],
"grandTotal": "1653.58",
"billingCurrency": "AUD"
},
"pricingOptions": {
"fareType": [
"PUBLISHED"
],
"includedCheckedBagsOnly": true
},
"validatingAirlineCodes": [
"EY"
],
"travelerPricings": [
{
"travelerId": "1",
"fareOption": "STANDARD",
"travelerType": "ADULT",
"price": {
"currency": "AUD",
"total": "1653.58",
"base": "1218.00",
"taxes": [
{
"amount": "11.42",
"code": "WG"
},
{
"amount": "28.00",
"code": "F6"
},
{
"amount": "50.26",
"code": "WY"
},
{
"amount": "60.00",
"code": "AU"
},
{
"amount": "4.00",
"code": "ZR"
},
{
"amount": "174.70",
"code": "GB"
},
{
"amount": "107.20",
"code": "UB"
}
],
"refundableTaxes": "435.58"
},
"fareDetailsBySegment": [
{
"segmentId": "5",
"cabin": "ECONOMY",
"fareBasis": "ENX03V5T",
"brandedFare": "YV",
"class": "E",
"includedCheckedBags": {
"weight": 30,
"weightUnit": "KG"
}
},
{
"segmentId": "6",
"cabin": "ECONOMY",
"fareBasis": "ENX03V5T",
"brandedFare": "YV",
"class": "E",
"includedCheckedBags": {
"weight": 30,
"weightUnit": "KG"
}
},
{
"segmentId": "63",
"cabin": "ECONOMY",
"fareBasis": "VLW13V5R",
"brandedFare": "YV",
"class": "V",
"includedCheckedBags": {
"weight": 30,
"weightUnit": "KG"
}
},
{
"segmentId": "64",
"cabin": "ECONOMY",
"fareBasis": "VLW13V5R",
"brandedFare": "YV",
"class": "V",
"includedCheckedBags": {
"weight": 30,
"weightUnit": "KG"
}
}
]
}
]
}
],
"travelers": [
{
"id": 1,
"dateOfBirth": "1981-10-18",
"gender": "MALE",
"name": {
"firstName": "Kunal Gunvant",
"lastName": "Parekh"
},
"contact": {
"emailAddress": "kunal.libra@gmail.com",
"phones": [
{
"deviceType": "MOBILE",
"countryCallingCode": "213",
"number": "0439378608"
}
]
},
"documents": [
{
"number": "90wjwi",
"issuanceDate": "2020-08-11",
"expiryDate": "2030-08-11",
"issuanceCountry": "AU",
"issuanceLocation": "Melbourne",
"nationality": "AU",
"birthPlace": "Mumbai",
"documentType": "PASSPORT",
"holder": true
}
]
}
]
}
}
And my curl request is: -
$xtoken = $this->amadeus_auth_test();
$auth = "Authorization: Bearer " . $xtoken;
$url = "https://test.api.amadeus.com/v1/booking/flight-orders";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt(
$curl,
CURLOPT_HTTPHEADER,
array(
$auth,
"Content-Type:application/json",
)
);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_FAILONERROR, true);
$token = curl_exec($curl);
$arr = json_decode($token, true);
$err = curl_error($curl);
curl_close($curl);
dump($err);
return $arr;
If you have come across or faced this problem or solved this problem please let me know.