TravelCaster API - Flights - GetFareOptions operation
Back to Flights home.
You can search for alternative fare options from a given fare returned by the flight availability operation. This operation performs a flight confirmation on the specified fare and the provided options, and returns alternative fares detailing what each of them includes. Those alternative fares should be considered as confirmed and ready to book. If no alternative fares are returned, you can proceed to the booking as if you had already performed the flight confirmation operation.
Each alternative fare contains the same fare informations as the original fare, but you will find additional informations for the fare name (as given by the airline) and what the fare includes (seat, baggage allowance, changes / refunds policy). Each fare will also have the price in the same currency as the one previously requested.
Please consider that you only need to use the applicable fare code on the booking request. Refer to the example below for a more practical explanation. In this example, from
GetFareOptionsResult
|
|_ Booking (FlightBookingRequest object)
| |
| |_ BookingFare (FlightFare object)
| |
| |_ FareID (string, same as the one selected from the GetFlightAvailability result)
| |_ *FareCode* [A] (string, null by default, can sometimes match one of the alternative fares returned)
| |_ TotalAmount = 100.25
|
|_ AllowedCardPayments (array of AllowedCardPayment - see FlightAvailabilityConfirmationResponse)
|
|_ AlternativeFares (array of FlightFare, ordered by price ascending)
|
|_ [0] (cheapest alternative)
| |
| |_ FareID (string, just for debugging purposes, just ignore it)
| |_ *FareCode* [B] = LITE
| |_ TotalAmount = 100.25
| |_ FareFeatures
|
|_ [1] (second cheapest alternative)
| |
| |_ FareID (string, just for debugging purposes, just ignore it)
| |_ *FareCode* [C] = BASIC
| |_ TotalAmount = 173.14
| |_ FareFeatures
|
|_ ...
As in the rest of the API operations, you will need a valid token, obtained previously with the GetAccessToken operation. If your token is no longer valid, you will receive a 1210 error. See the Transaction Codes page for more information.
The GetFareOptions operation returns a FlightFareOptionsResponse object that wraps the ConfirmFlightAvailability response in a Booking field, adding a field AlternativeFares for the new informations.
Book an alternative fare
In case of GetFareOptions, you will try to book one of the provided "AlternativeFares",use the Booking.BookingFare to complete the the selected alternative and provide it into the request.
- AlternativeFares[selectedIndex].FareID ← Booking.BookingFare.FareID
- AlternativeFares[selectedIndex].Legs ← Booking.BookingFare.Legs
See more information about BookFlight operation.
Request
JSON
http://endpoint/api/version/FlightService.json/GetFareOptions [POST]
url-encoded parameter: options ([FlightFareOptionsRequest])
returns: FlightFareOptionsResponse
WebService
http://endpoint/api/version/FlightService.asmx
operation: GetFareOptions
parameters: options ([FlightFareOptionsRequest])
returns: FlightFareOptionsResponse
Structure of the FlightFareOptionsRequest object
FlightFareOptionsRequest
|
|_ Token (string)
|_ RecommendationID (string)
|_ FareID (string)
|_ OptionID (string[] - one for each leg you requested)
Structure of the FlightFareOptionsResponse object
FlightFareOptionsResponse
|
|_ Token (string)
|_ TransactionID (string)
|_ TransactionCode (string)
|_ TransactionMessage (string)
|_ Booking (FlightBookingRequest - see FlightBookingRequest for structure)
|_ AlternativeFares (FlightFare[] - see FlightRecommendation for structure)
|_ AllowedCardPayments (AllowedCardPayment[] - see FlightAvailabilityConfirmationResponse for structure)
Notes
- Be sure to include all required IDs: this operation checks the request for one RecommendationID, one FareID and one OptionID for each leg you queried. One-way queries will have one OptionID, round-trip ones will have two.
- Dates sent to and from the API are all string-based and in the YYYY-MM-DD ISO-8061 format.
- The PaxInformation object received in the passenger array inside the returning FlightFareOptionsResponse object differ from the PaxOption object sent in the GetFlightAvailability operation. In this case, you will have one PaxInformation object for each passenger. If you queried 2 adults, you will end with 2 PaxInformation items.
- Do not change any existing data from the returning FlightFareOptionsResponse other than the fare code of the inner fare if you want to book an alternative fare. Just add the data required for the BookFlight operation.
Back to Flights home.