Step 3 - Query data
Update content type
To send query data you now need to pass it in the body in JSON format application/json instead of form-data x-www-form-urlencoded.
This is an example of query data passed in the create request
curl --location --request POST 'https://partners.api.skyscanner.net/apiservices/v3/flights/live/search/create' \
--header 'x-api-key: prtl6749387986743898559646983194' \
--header 'Content-Type: application/json' \
--data-raw '...'
Update query
We will also need to send through the query data in JSON format. You do this by passing through a query object.
curl --location --request POST 'https://partners.api.skyscanner.net/apiservices/v3/flights/live/search/create' \
--header 'x-api-key: prtl6749387986743898559646983194' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": {
"market": "UK",
"locale": "en-GB",
"currency": "GBP",
...
}
}'
In v3 there is a new query object that is used to search for your flights. You will need to build out this object based on your needed search criteria.
info
What is the Query object
You can find a full explanation of the query object. Query object guide
Here is a sample of a query object:
{
"query": {
"market": "UK",
"locale": "en-GB",
"currency": "GBP",
"queryLegs": [
{
"originPlaceId": {
"iata": "EDI" // The IATA code for the "Edinburgh" airport
},
"destinationPlaceId": {
"entityId": "27544008" // The internal Skyscanner ID for the "London" city
},
"date": {
"year": 2022,
"month": 9,
"day": 21
}
},
{
"originPlaceId": {
"entityId": "27544008"
},
"destinationPlaceId": {
"iata": "EDI"
},
"date": {
"year": 2022,
"month": 9,
"day": 30
}
}
],
"adults": 1,
"childrenAges": [],
"cabinClass": "CABIN_CLASS_ECONOMY",
"excludedAgentsIds": [],
"excludedCarriersIds": [],
"includedAgentsIds": [],
"includedCarriersIds": [],
"includeSustainabilityData": false,
"nearbyAirports": false
}
}