I have been using Amadeus api to design a flight booking system. Sometimes, it goes through and the flight booking works (note that i am in sandbox mode) while some times i run into errors some of which i can't explain. I can test it now and it works and in another ten minutes i test again and an error pops up. I would love to know meaning of the frequent ones i get and how to avoid them.
here is one
"errors" : [ {
"status" : 400,
"code" : 34651,
"title" : "SEGMENT SELL FAILURE",
"detail" : "Could not sell segment 1",
"source" : {
"pointer" : "/data/flightOffers[0]/itineraries[0]/segments[0]"
}
} ]
}
here is another
"errors" : [ {
"code" : 4926,
"title" : "INVALID DATA RECEIVED",
"detail" : "No fare applicable",
"status" : 400
} ]
}```
INVALID DATA RECEIVED means that some of the data in your query is false. It can be that you sent a fare that does not match your class or the flight number is incorrect etc. This is common to all our APIs, it comes from the API backend validating your query.
SEGMENT SELL FAILURE this means that you were not able to book the seat you want in the inventory of the airline. Most of the time, it comes from the flight being full. In the test environment, you can perform many bookings without restrictions (no real payment), but the inventory is a copy of the real one, so if you book many seats, the inventory will be empty and you won't be able to book anymore. It can come from a wrong fare, or flight number as well. The good practice is to price right before booking (note that in test it can still happen as many bookings are going at the same time from other users). But with this message, it is the inventory that rejects you.