In version 22.1, there is a breaking change to how flight plans are returned in both the v1 and v2 APIs. Please see here for the updated format - this is returned as a JSON string.
We apologise for the lack of prior notice for this change, but hope this will mean you can do some cooler stuff with flight plans now. If you have any questions, please feel free to let us know and we’ll help you out where we can.
It will come to the API in a future update, but to see it for your own purposes just go to the logbook page from the left hand side of the Home Screen in the app.
Assuming the state names are all the same, does it mean only aircraft/0/flightplan returns a JSON string? If so, have the other states changed the format/data returned? What about aircraft/0/flightplan/full_info?
I assume this now implies that for any app using the v2 API it will now be needed to check the version of IF and handle flight plan states accordingly?
All state names have remained the same as far as I know. As for the actual content of states, the best way to check those is through experimentation. And yes, I would absolutely check your app for issues.
Following on my own question, it looks like for the v2 API only aircraft/0/flightplan/full_info is impacted. Is that right? From my quick tests, it looks like the other flight plans states aren’t JSON and haven’t changed.
I’ve been playing with this feature further in the v2 Connect API via aircraft/0/flightplan/full_info and have hit a challenge.
I have set up a flight from KSFO to KSAN and entered a flight plan. While still sitting on the runway before takeoff I fetch the flight plan and get back results that include the following entry:
"ETEToNext":NaN
But, this can’t be parsed to JSON using JSON.parse() in JavaScript:
SyntaxError: Unexpected token N in JSON at position ...
If I replace the value with null or 0 that works fine. I assume that because the speed of the aircraft is zero somewhere in generating the JSON a distance is divided by speed to generate this value and this leads to a divide-by-zero which generates the NaN. But, wouldn’t it be better to return null rather than NaN so that the string can be parsed to JSON without first doing some form of transformation on the string itself? Right now, I need to search and replace in the string to remove the NaN before using the string.
Also, what’s odd is that I would have expected ETEToDestination would also be NaN by the same logic but it isn’t:
"ETEToDestination":5.197206E+09
So, it seems this is inconsistent as well unless I am not understanding what’s going on.