how does a flight booking API work