POST /lowest-fare-offers v2

POST /lowest-fare-offers v2

The LowestFareOffers endpoint provides the available flight offers with the lowest fare based on a certain period (Overall, Months or Days). 

HOW TO USE?

The POST method should be used to start a search for lowest fare offers.
Use case flow can then be followed by the consumer by requesting the GET methods (for LowestFareOffers & AvailableOffers) supplied as HATEOAS link in the POST response body.

The GET method returns the same response data structure as the POST method.

HEADERS TO USE FOR REQUEST

Parameter

Value

Authorization 

Bearer {{token}}

Content-Type 

application/json

Accept 

application/hal+json;profile=com.afklm.flightoffers.lowest-fare-offers.v2;charset=utf8

Accept-Language 

{{language}}-{{country}}

AFKL-TRAVEL-Host 

KL or AF

AFKL-TRAVEL-Country 

Country (overrides Accept-Language country)


POST

POST https://api.klm.com/opendata/flightoffers/lowest-fare-offers{?expand-suggested-flights,type} 

QUERY PARAMETERS

Name

Type

Multiplicity

Description

expand-suggested-flights

Boolean

0-1

When true the segment details are expanded in the response. Otherwise the response details for connections and segments match the request details.

type

String

1

Indicates the type of request being fired.

OVERALL, MONTH or DAY.

POST PARAMETERS

Name

Type

Multiplicity

Description

cabinClass

String

1

Code for requested cabin class.

ECONOMY or BUSINESS

currency

String

0-1

Indicates the currency to be used for prices in response.

Three letter currency code according to ISO 4217.

This can be used to override the setting for the default currency of the country of the origin airport (also known as Point of Sale).

discountCode

String

0-1

code for IDC discount.

displayPriceContent

Enumeration

0-1

Content of displayPrice in response.

- If empty : displayPrice is the price for 1adt regarding point of sell

- ALL_PAX_ROUNDED : displayPrice is the price for all pax regarding point of sell rounded up

includeCarriers

Array of Strings

0-n

List of marketing carriers to include in the request. When shortest=true, includeCarriers cannot be supplied

minimumAccuracy

Integer

0-1

Threshold for required accuracy. Overrides default threshold. When accuracy is below supplied threshold, backend will switch to more accurate source.

NB Currently TripPlanner GetBudgetSearch is fast, less accurate source and TripPlanner GetData is more accurate source.

reservationId

String

0-1

Identification of the reservation for which a rebooking is requested. Only supplied for Rebooking a ticket. reservationId is the conversation state identifier.

shortest

Boolean

0-1

Indicates whether shortest route should be found. Otherwise lowest fare is found. When shortest=true, includeCarriers cannot be supplied.

fallbackMode

Enumeration

0-1

Fallback mode to find matching flights:

- NONE (default): No fallback applied

- FAREFAMILY: If fareFamilyCode supplied does not give any results, result with different FareFamily will be returned.

- ANY: If fareBasis/sellingClasses supplied does not give any results, result with different fareBasis/sellingClasses will be returned. If that does not give any results, result with different FareFamily will be returned.

passengerCount

Object

1

The specification of the passengers for which the offer is requested.

..ADULT

Integer

0-1

Number of adults. 16 years and older.

..CHILD

Integer

0-1

Number of children. 2-11 years.

..INFANT

Integer 

0-1

Number of infants. Under 2 years.

..YOUNG_ADULT

Integer

0-1

Number of young adults. 12-15 years.

requestedConnections

Array of Objects

1-6

A chronologically ordered list of connections for which the lowest fare offers is requested.

..dateInterval

String

0-1

String representing a date interval. Format is: "YYYY-MM-DD/YYYY-MM-DD".

Date interval describes the range of dates that should be used to find lowest fares for the Connection.

Conditional: Must be supplied for at least 1 connection.

..fareBasis

String

0-1

The fare basis of the connection.

Conditional: Must not be supplied when origin & destination are supplied. Can be supplied when segments are supplied. In case it is supplied, the selling class must also be supplied in segments.

..fareFamilyCode

String

0-1

The fare family of the connection.

Conditional: Must not be supplied when origin & destination are supplied. Can be supplied when segments are supplied. In case it is supplied, the fare basis must also be supplied.

..minDaysOfStay

Integer

0-1

Minimum days of stay between this and next connection.

Conditional: Either both or none of min/maxStayOfDays must be supplied.

..maxDaysOfStay

Integer

0-1

Maximum days of stay between this and next connection.

Conditional: Either both or none of min/maxStayOfDays must be supplied.

..origin

Object

0-1

The origin station of the connection.

Conditional: Either origin & destination are supplied or segments are supplied.

....city

Object

0-1

The city of origin.

Conditional: Either city or airport must be supplied.

…...code

String

1

IATA location code of the city.

....airport

Object

0-1

The airport of origin.

Conditional: Either city or airport must be supplied.

…...code

String

1

IATA location code of the airport.

..destination

Object

0-1

The destination station of the connection.

Conditional: Either origin & destination are supplied or segments are supplied.

....city

Object

0-1

The city of destination.

Conditional: Either city or airport must be supplied.

…...code

String

1

IATA location code of the city.

....airport

Object

0-1

The airport of destination.

Conditional: Either city or airport must be supplied.

…...code

String

1

IATA location code of the airport.

..segments

Array of Objects

0-6

A chronologically ordered list of segments that describe the Connection requested.

Conditional: Either origin & destination are supplied or segments are supplied.

….origin

Object

0-1

The origin airport of the connection.

…...code

String

1

IATA location code of the airport.

….destination

Object

0-1

The destination airport of the connection.

…...code

String

1

IATA location code of the airport.

….departureDateTime

DateTime

1

DateTime of departure of the segment flight. It is specified as local time at origin of the segment.

….marketingFlightNumber

String

1

The marketing flight number for the segment.

Max of four digits, when less than 3 then prefix with zeroes up till 3 digits. For example: 006, 022, 1001.

….marketingCarrier

Object

1

IATA airline code for the marketing carrier of the flight.

….sellingClass

Object

0-1

Selling Class of the selected flight

ERROR CODES

HTTP status

Type

500

INTERNAL_SERVER_ERROR

500

FOA/INTERNAL_SERVER_ERROR/UNSUPPORTED_CAPABILITY

400

FOA/DISCOUNT_CODE_INELIGIBLE

SAMPLE POST REQUEST

{
    "type": "DAY", 
    "currency": "EUR", 
    "cabinClass": "ECONOMY", 
    "passengerCount": {
        "ADULT": 1, 
        "CHILD": 0, 
        "INFANT": 0
    }, 
    "requestedConnections": [
        {
            "segments": [
                {
                    "departureDateTime": "2015-04-05T13:30:00Z", 
                    "origin": {
                        "code": "AMS", 
                        "city": {
                            "code": "AMS"
                        }
                    }, 
                    "farebase": {
                        "code": "RSRNL"
                    }, 
                    "destination": {
                        "code": "JFK", 
                        "city": {
                            "code": "NYC"
                        }
                    }, 
                    "marketingFlight": {
                        "number": "1016", 
                        "carrier": {
                            "code": "KL"
                        },
			"sellingClass": {
                            "code": "R"
                        },
                    }
                }
            ]
        }, 
        {
            "period": "2015-04-06/2015-04-07", 
            "origin": {
                "city": {
                    "code": "NYC"
                }
            }, 
            "destination": {
                "airport": {
                    "code": "AMS"
                }
            }
        }
    ]
}

SAMPLE RESPONSE

{
    "flightProducts": [
        {
            "type": "DAY", 
            "connections": [
                {
                    "_links": {
                        "fixConnectionDate": {
                            "href": "https://api.klm.com/b2c/flightoffers/lowest-fare-offers?d=jjfdjhfjdkshjfdhsfgahggcgkfygclgagvbygvblfagk&dateInterval={dateInterval}", 
                            "templated": true
                        }, 
                        "availableOffers": {
                            "href": "https://api.klm.com/b2c/flightoffers/available-offers?d=hgfgsdgfdgfgdfgaggfhagfgGGUIFdbHGGGDYIGSjsjfhdshgsfdhgu-shkl"
                        }
                    }, 
                    "segments": [
                        {
                            "farebase": {
                                "code": "RSRNL"
                            }, 
                            "marketingFlight": {
                                "number": "1016", 
                                "carrier": {
                                    "code": "KL", 
                                    "name": "KLM"
                                }
                            }, 
                            "departureDateTime": "2015-04-05T13:30", 
                            "origin": {
                                "code": "AMS", 
                                "name": "Schiphol", 
                                "city": {
                                    "code": "AMS", 
                                    "name": "Amsterdam"
                                }
                            }, 
                            "destination": {
                                "code": "JFK", 
                                "name": "John F. Kennedy Airport", 
                                "city": {
                                    "code": "NYC", 
                                    "name": "New York"
                                }
                            }
                        }
                    ]
                }, 
                {
                    "_links": {
                        "fixConnectionDate": {
                            "href": "https://api.klm.com/b2c/flightoffers/lowest-fare-offers?d=jjfdjhfjdkshjfdhsfgahggcgkfygclgagvbygvblfagk&dateInterval={dateInterval}", 
                            "templated": true
                        }, 
                        "availableOffers": {
                            "href": "https://api.klm.com/b2c/flightoffers/available-offers?d=hgfgsdgfdgfgdfgaggfhagfgGGUIFdbHGGGDYIGSjsjfhdshgsfdhgu-shkl"
                        }
                    }, 
                    "dateInterval": "2015-04-06/2015-04-06", 
                    "origin": {
                        "city": {
                            "code": "NYC", 
                            "name": "New York"
                        }
                    }, 
                    "destination": {
                        "airport": {
                            "code": "AMS", 
                            "name": "Schiphol", 
                            "city": {
                                "code": "AMS", 
                                "name": "Amsterdam"
                            }
                        }
                    }
                }
            ], 
            "passengers": [
                {
                    "id": 1, 
                    "type": "ADT"
                }
            ], 
            "price": {
                "currency": "EUR", 
                "displayPrice": 787.15, 
                "totalPrice": 797.15, 
                "displayType": "TAX", 
                "pricePerPassengerType": [
                    {
                        "passengerType": "ADT", 
                        "fare": 487, 
                        "taxes": 300.15
                    }
                ], 
                "surcharges": [
                    {
                        "code": "BookingFee", 
                        "amount": 10
                    }
                ], 
                "accuracy": 77.9
            }
        }, 
        {
            "type": "DAY", 
            "connections": [
                {
                    "_links": {
                        "fixConnectionDate": {
                            "href": "https://api.klm.com/b2c/flightoffers/lowest-fare-offers?d=jjfdjhfjdkshjfdhsfgahggcgkfygclgagvbygvblfagk&dateInterval={dateInterval}", 
                            "templated": true
                        }, 
                        "availableOffers": {
                            "href": "https://api.klm.com/b2c/flightoffers/available-offers?d=hgfgsdgfdgfgdfgaggfhagfgGGUIFdbHGGGDYIGSjsjfhdshgsfdhgu-shkl"
                        }
                    }, 
                    "segments": [
                        {
                            "marketingFlight": {
                                "number": "1016", 
                                "carrier": {
                                    "code": "KL", 
                                    "name": "KLM"
                                }
                            }, 
                            "departureDateTime": "2015-04-05T13:30", 
                            "farebase": {
                                "code": "RSRNL"
                            }, 
                            "origin": {
                                "code": "AMS", 
                                "name": "Schiphol", 
                                "city": {
                                    "code": "AMS", 
                                    "name": "Amsterdam"
                                }
                            }, 
                            "destination": {
                                "code": "JFK", 
                                "name": "John F. Kennedy Airport", 
                                "city": {
                                    "code": "NYC", 
                                    "name": "New York"
                                }
                            }
                        }
                    ]
                }, 
                {
                    "_links": {
                        "fixConnectionDate": {
                            "href": "https://api.klm.com/b2c/flightoffers/lowest-fare-offers?d=jjfdjhfjdkshjfdhsfgahggcgkfygclgagvbygvblfagk&dateInterval={dateInterval}", 
                            "templated": true
                        }, 
                        "availableOffers": {
                            "href": "https://api.klm.com/b2c/flightoffers/available-offers?d=hgfgsdgfdgfgdfgaggfhagfgGGUIFdbHGGGDYIGSjsjfhdshgsfdhgu-shkl"
                        }
                    }, 
                    "dateInterval": "2015-04-07/2015-04-07", 
                    "origin": {
                        "city": {
                            "code": "NYC", 
                            "name": "New York"
                        }
                    }, 
                    "destination": {
                        "airport": {
                            "code": "AMS", 
                            "name": "Schiphol", 
                            "city": {
                                "code": "AMS", 
                                "name": "Amsterdam"
                            }
                        }
                    }
                }
            ], 
            "passengers": [
                {
                    "id": 1, 
                    "type": "ADT"
                }
            ], 
            "price": {
                "currency": "EUR", 
                "displayPrice": 932.45, 
                "totalPrice": 942.45, 
                "displayType": "TAX", 
                "pricePerPassengerType": [
                    {
                        "passengerType": "ADT", 
                        "fare": 700, 
                        "taxes": 232.45
                    }
                ], 
                "surcharges": [
                    {
                        "code": "BookingFee", 
                        "amount": 10
                    }
                ], 
                "accuracy": 88.9
            }
        }
    ]
}

Docs Navigation