Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Cannot pull in live data from API for the flights #5

Open
lukemenziesAA opened this issue May 17, 2022 · 7 comments
Open

Cannot pull in live data from API for the flights #5

lukemenziesAA opened this issue May 17, 2022 · 7 comments

Comments

@lukemenziesAA
Copy link

Hi,

I am trying to pull in live data from the API for the flights but it keeps returning a null response in the live section of the json.

I am using the following command

https://api.aviationstack.com/v1/flights?access_key=*access_kay*&limit=10&offset=0

I am using a basic plan? I get the following response

{
"pagination": {
"limit": 10,
"offset": 0,
"count": 10,
"total": 9594200
},
"data": [ ...
{
"flight_date": "2022-05-18",
"flight_status": "scheduled",
"departure": {
"airport": "Kingsford Smith",
"timezone": "Australia/Sydney",
"iata": "SYD",
"icao": "YSSY",
"terminal": null,
"gate": null,
"delay": null,
"scheduled": "2022-05-18T03:15:00+00:00",
"estimated": "2022-05-18T03:15:00+00:00",
"actual": null,
"estimated_runway": null,
"actual_runway": null
},
"arrival": {
"airport": "Adelaide International Airport",
"timezone": "Australia/Adelaide",
"iata": "ADL",
"icao": "YPAD",
"terminal": null,
"gate": null,
"baggage": null,
"delay": null,
"scheduled": "2022-05-18T05:00:00+00:00",
"estimated": "2022-05-18T05:00:00+00:00",
"actual": null,
"estimated_runway": null,
"actual_runway": null
},
"airline": {
"name": "Qantas",
"iata": "QF",
"icao": "QFA"
},
"flight": {
"number": "7448",
"iata": "QF7448",
"icao": "QFA7448",
"codeshared": null
},
"aircraft": null,
"live": null
}
]
}

If someone can give some insight into what is going wrong, I would be most grateful.

Thanks

Luke

@jinxyCat14
Copy link

Luke,

'live' is null when there is no live data for the flight (not being cute)

This makes sense because look at the "flight_status" variable - its "scheduled" which means the aircraft hasn't taken off, it just has a flight plan filed, definitely isn't airborne.

If you're only looking for live data then filter your API request to 'flight_status' : 'active' to only get flights that are currently in the air which have a better chance of containing 'live' data which will look something like this instead of null:
'live': {'updated': '2022-10-07T22:41:04+00:00', 'latitude': 56.11, 'longitude': 40.45, 'altitude': 10668, 'direction': 88, 'speed_horizontal': 926, 'speed_vertical': 0, 'is_ground': False}}]

Hope this helps! I've been knee deep in this API for a class so getting fairly familiar with it, let me know if you have other questions!

-jinxyCat14

@CoreyBin
Copy link

Luke,

'live' is null when there is no live data for the flight (not being cute)

This makes sense because look at the "flight_status" variable - its "scheduled" which means the aircraft hasn't taken off, it just has a flight plan filed, definitely isn't airborne.

If you're only looking for live data then filter your API request to 'flight_status' : 'active' to only get flights that are currently in the air which have a better chance of containing 'live' data which will look something like this instead of null: 'live': {'updated': '2022-10-07T22:41:04+00:00', 'latitude': 56.11, 'longitude': 40.45, 'altitude': 10668, 'direction': 88, 'speed_horizontal': 926, 'speed_vertical': 0, 'is_ground': False}}]

Hope this helps! I've been knee deep in this API for a class so getting fairly familiar with it, let me know if you have other questions!

-jinxyCat14

Hi jinxyCat14,

If the lack of real-time data is understandable, then why is the data of aircraft also null, I need this data.So I'm trying to figure this out.

Looking forward to your reply.

Jaryn

@jinxyCat14
Copy link

Good question, the other fields that are null are all sections that may not be populated yet. A flight that is only scheduled obviously doesn’t have any ‘actual’ data - it only exists inside the computer system. The null fields will become filled with data when the flight becomes ‘active’.
-jinxyCat14

@JonasJ96
Copy link

JonasJ96 commented Nov 6, 2023

Did you ever figure this out? @lukemenziesAA
I have having the same issue, it is also present for ''active'' flights..

@alihamza-14
Copy link

I am getting same for flight_status=active,

{
"pagination": {
"limit": 100,
"offset": 0,
"count": 100,
"total": 454057
},
"data": [
{
"flight_date": "2024-03-30",
"flight_status": "active",
"departure": {
"airport": "King Khaled International",
"timezone": "Asia/Riyadh",
"iata": "RUH",
"icao": "OERK",
"terminal": "T4",
"gate": null,
"delay": 11,
"scheduled": "2024-03-30T09:55:00+00:00",
"estimated": "2024-03-30T09:55:00+00:00",
"actual": "2024-03-30T10:05:00+00:00",
"estimated_runway": "2024-03-30T10:05:00+00:00",
"actual_runway": "2024-03-30T10:05:00+00:00"
},
"arrival": {
"airport": "Istanbul Airport",
"timezone": "Europe/Istanbul",
"iata": "IST",
"icao": "LTFM",
"terminal": "1",
"gate": null,
"baggage": "25",
"delay": null,
"scheduled": "2024-03-30T14:50:00+00:00",
"estimated": "2024-03-30T14:50:00+00:00",
"actual": null,
"estimated_runway": null,
"actual_runway": null
},
"airline": {
"name": "Aeroflot",
"iata": "SU",
"icao": "AFL"
},
"flight": {
"number": "4115",
"iata": "SU4115",
"icao": "AFL4115",
"codeshared": {
"airline_name": "saudia",
"airline_iata": "sv",
"airline_icao": "sva",
"flight_number": "263",
"flight_iata": "sv263",
"flight_icao": "sva263"
}
},
"aircraft": null,
"live": null
},

please tell how to get live coordinates if someone figured  it out?

@alihamza-14
Copy link

@JonasJ96 @lukemenziesAA
did you guys find solution?

@jinxyCat14
Copy link

@alihamza-14 haven't touched the API in over a year but just ran another API pull.

Best I can guess is that the majority of 'active' flights that do not have "live" information. I only have the free version so can't get you better stats but only 5 of the 100 flights had updated 'live' info with a lat/long the rest were null. Of those 5 with live data only 4 were in the air with one on the ground.

Hopefully that helps?
-jinxyCat14

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@CoreyBin @lukemenziesAA @JonasJ96 @jinxyCat14 @alihamza-14 and others