🛩️ Requête de base de données des aéroports
Exemples de requêtes API :
- Récupérer la liste des aéroports :
curl -X 'GET' \
'https://sharpapi.com/api/v1/airports' \
-H 'accept: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY'
Réponse
{
"data": [
{
"id": "1ef266de-5a6c-67d6-86a1-06bb2780ed98",
"icao": "00AA",
"iata": "",
"lid": "00AA",
"name": "Aero B Ranch Airport",
"city": "Leoti",
"subdivision": "Kansas",
"country": "US",
"timezone": "America/Chicago",
"elevation": 3435,
"latitude": 38.7,
"longitude": -101.47
},
{
"id": "1ef266de-5ad4-6660-bae6-06bb2780ed98",
"icao": "00SC",
"iata": "",
"lid": "00SC",
"name": "Flying O Airport",
"city": "Sumter",
"subdivision": "South Carolina",
"country": "US",
"timezone": "America/New_York",
"elevation": 150,
"latitude": 34.01,
"longitude": -80.27
}
],
"links": {
"first": "https://sharpapi.com/api/v1/airports?page=1",
"last": "https://sharpapi.com/api/v1/airports?page=1128",
"prev": null,
"next": "https://sharpapi.com/api/v1/airports?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1128,
"links": [
{
"url": null,
"label": "« Précédent",
"active": false
},
{
"url": "https://sharpapi.com/api/v1/airports?page=1",
"label": "1",
"active": true
},
{
"url": "https://sharpapi.com/api/v1/airports?page=1127",
"label": "1127",
"active": false
},
{
"url": "https://sharpapi.com/api/v1/airports?page=1128",
"label": "1128",
"active": false
},
{
"url": "https://sharpapi.com/api/v1/airports?page=2",
"label": "Suivant »",
"active": false
}
],
"path": "https://sharpapi.com/api/v1/airports",
"per_page": 25,
"to": 25,
"total": 28186
}
}
Détails de l'aéroport
- Récupérer les données spécifiques d'un aéroport par ID :
curl -X 'GET' \
'https://sharpapi.com/api/v1/airports/1ef266e0-00ca-656e-b481-06bb2780ed98' \
-H 'accept: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY'
Réponse
{
"data": {
"id": "1ef266e0-00ca-656e-b481-06bb2780ed98",
"icao": "WSSS",
"iata": "SIN",
"lid": "",
"name": "Singapore Changi International Airport",
"city": "Singapore",
"subdivision": "North East",
"country": "SG",
"timezone": "Asia/Singapore",
"elevation": 22,
"latitude": 1.35,
"longitude": 103.99
}
}
- Récupérer les données spécifiques d'un aéroport par code IATA :
curl -X 'GET' \
'https://sharpapi.com/api/v1/airports/iata/SIN' \
-H 'accept: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY'
Calculs de durée de vol
curl -X 'GET' \
'https://sharpapi.com/api/v1/airports/flight_duration/IATA/SIN/2024-06-27/01%3A40/IATA/DXB/2024-06-27/12%3A10' \
-H 'accept: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY'
Réponse
{
"flight_length": {
"days": 0,
"hours": 14,
"minutes": 30,
"human": "14 heures 30 minutes",
"human_cn": "14 小时 30 分钟"
},
"departure_local": "2024-06-27 01:40:00",
"arrival_local": "2024-06-27 12:10:00",
"departure_airport": {
"id": "1ef266e0-00ca-656e-b481-06bb2780ed98",
"icao": "WSSS",
"iata": "SIN",
"lid": "",
"name": "Singapore Changi International Airport",
"city": "Singapore",
"subdivision": "North East",
"country": "SG",
"timezone": "Asia/Singapore",
"elevation": 22,
"latitude": 1.35,
"longitude": 103.99
},
"arrival_airport": {
"id": "1ef266df-80aa-62e4-ac59-06bb2780ed98",
"icao": "OMDB",
"iata": "DXB",
"lid": "",
"name": "Dubai International Airport",
"city": "Dubai",
"subdivision": "Dubai",
"country": "AE",
"timezone": "Asia/Dubai",
"elevation": 34,
"latitude": 25.25,
"longitude": 55.36
}
}