AirlineFlightSchedules empty at certain times of day

Weird issue.

Querying the AirlineFlightSchedules API I get inconsistent results. It worked fine on the weekend and now my code is returning empty.



PS ..\dev >> $flight = Invoke-RestMethod -Method Get -Uri "https://flightxml.flightaware.com/json/FlightXML2/AirlineFlightSchedules?startDate=$($today)&endDate=$($tomorrow)&airline=$($airline)&flightno=$($flightno)" -Headers $Headers -Verbose
VERBOSE: GET https://flightxml.flightaware.com/json/FlightXML2/AirlineFlightSchedules?startDate=147368344
4&endDate=1473856244&airline=baw&flightno=17 with 0-byte payload
VERBOSE: received 62-byte response of content type application/json; charset=UTF-8

PS ..\dev >> $flight

AirlineFlightSchedulesResult           
----------------------------           
@{next_offset=-1; data=System.Object]}



PS ..\dev >> $flight.AirlineFlightSchedulesResult.data

PS ..\dev >> 


Any idea why this is?
My understanding is that this API returns flights also from the future that are scheduled.

I am really struggling to get consistent info back from the FA API to display information for a given flight number for the next day or actually for the next time a given flight number is scheduled to fly. This shouldn’t be this hard?!

Any ideas?

Do you believe that the behavior changed when using the same timestamp range values, but invoked at different times of day?

Or simply that the specified timestamp values are not being interpreted precisely? (At the moment, I recommend using whole day granularity for the start and end times and doing more precise filtering within the results using your own application code.)

Well, I believe something is weird or I don’t understand the start and endtime.


$today = ([Math]::Floor([decimal](Get-Date(Get-Date).ToUniversalTime()-uformat "%s"))).ToString()
$5days = [Math]::Floor([decimal](Get-Date((Get-Date).AddDays(5)).ToUniversalTime()-uformat "%s"))

$req_query_flightnumber = 'uae408'
$airline = $req_query_flightnumber.Substring(0,3)
$flightno = $req_query_flightnumber.Substring(3)

$flight = Invoke-RestMethod -Method Get -Uri "https://flightxml.flightaware.com/json/FlightXML2/AirlineFlightSchedules?startDate=$($today)&endDate=$($tomorrow)&airline=$($airline)&flightno=$($flightno)" -Headers $Headers -Verbose

VERBOSE: GET https://flightxml.flightaware.com/json/FlightXML2/AirlineFlightSchedules?startDat
e=1473712984&endDate=1474144934&airline=uae&flightno=408 with 0-byte payload
VERBOSE: received 62-byte response of content type application/json; charset=UTF-8

PS ..\dev >> $flight.AirlineFlightSchedulesResult.data

PS ..\dev >> ConvertFrom-Unixdate -UnixDate 1474144934

Sunday, 18 September 2016 6:42:14 AM



PS ..\dev >> ConvertFrom-Unixdate -UnixDate 1473712984

Tuesday, 13 September 2016 6:43:04 AM

There definitely IS a UAE408 scheduled in the next 5 days, in fact it’s a daily flight. I get the same result right now with any other Flight number that I try. QFA400, DLH400, BAW17.

How would I get the next upcoming flight for a given flight number?

okay, layer 8 issue.
Flight details are case-sensitive:
DLH400 - works
dlh400 - does not work

Need to change my code to capitalize the airline code.