Reputation: 31985
I just started to try Google's QPX Express API, an airline ticket search API. However, so many query results differ from those I get in Google Flights.
I'm not sure what I'm missing, but at least it should return the same results since Google Flights use the API internally.
For example, here is what I tried in Python:
import json
import requests
url = "https://www.googleapis.com/qpxExpress/v1/trips/search?key=myAPIKey"
headers = {
"content-type": "application/json"
}
with open("sample.json") as fp:
data = json.load(fp)
r = requests.post(url, data=json.dumps(data), headers=headers)
print(r.json()["trip"]["tripOption"][0]["pricing"][0]["saleTotal"])
This should return the cheapest flight ticket. However, this seems to be different from the one you can get from Google Flights on the Web. My JSON file, which should be poured into the body of the request, is the following:
{
"request": {
"passengers": {
"adultCount": 1,
"childCount": 0,
"infantInLapCount": 0,
"infantInSeatCount": 0,
"seniorCount": 0
},
"slice": [
{
"origin": "PEK",
"destination": "MIL",
"date": "2017-01-14",
"maxStops": 1
}
],
"maxPrice": "USD500",
"saleCountry": "US",
"refundable": false,
"solutions": 500
}
}
I typed in the same input into Google Flights, but the result was different.
Why do they return the different results? What am I missing here?
As of now, the QPX returned the cheapest flight as 239USD while Google Flights returned 241USD.
Upvotes: 4
Views: 1094
Reputation: 41
I noticed that the QPX API and Ita Software Matrix (by Google) gives the same results, not including a lot of companies like Ryanair. Google flights includes these results.
I asked Google Support about it.
The answer is:
"QPX Express API and Matrix only include fares that are filed with ATPCO. There are a number of small carriers and low cost carriers that do not file."
Asking Google if they consider to add these flights to their APIs the answer was:
"Airlines determine which distribution channel they want to participate in. If any of these airlines were to file with ATPCO, then we would certainly be interested."
Upvotes: 3