Feature Request: Accept multiple flight ids for Get Flight Plan Endpoint

Hi Cameron,

It would be nice if the Get Flight Plan can accept a list of flight ids, maybe comma separated or as an array.
Example: https://api.infiniteflight.com/public/v2/flight//flightplan?id=12312541&id=9877835&id=219873

I believe this can be a fairly frequent use case and would help, especially after the removal of the Get All Flight Plans endpoint which is currently deprecated.

Hey Sanket,

Thanks for the feedback. Do you have some use cases you’d apply this for?

The reason why we haven’t added this: the new flight plan format returns a lot of data, so responses would be massive for multiple flight plans.

1 Like

I am currently reworking on my bot with Discord 13 features. I used the previous Get All Flight Plans to fetch the route of each user.

So after the deprecation of that endpoint, I am paginating the results to 10 for each “page” (The next 10 are fetched after a button click after the message) to reduce the response time on my bot as well the load on the IF servers. So it would be quite nice to be able to fetch all of those 10 flight plans together.

i don’t know how frequent this use case would be though, haha.

PS: I love the new details like type and the groups

Hey Sanket,

I’ve been doing some Public API work recently and this looks like an interesting feature. Would you mind adding it to the API Trello board? This is mostly where I look when I decide what to implement. You may also notice some things in the “Done” column that we haven’t announced yet - all in due course 😉

2 Likes

Hey Kai, I had actually put a request like this on the board a while back, but it seems to have been moved into the “Won’t add” category. Has the verdict changed since then?

1 Like

Hey Ethan!

Which one was it? I should be able to explain why it’s ended up there.

Gonna go out on a limb and say Trello

Yes, that’s the one.

The main reason we deprecated the endpoint that used to do this and the reason why we’re reluctant to implement it again is because we store flight plan individually. They’re stored in a key-value fashion, and we can only look them up individually - it’s not like a database where we can get them all at one. That means it’s a lot of time, computing power, and bandwidth to get multiple flight plans. If I were to implement an endpoint like this where you can request multiple, I’d have to do some testing to see what is fast but I’d probably cap it at like 5 or 10 per request, and of course you’ve still got the rate limit.

If you like, perhaps you could give some more details on your use case and I’ll see if there’s any other way it can be done.

3 Likes

“Historical Data for Live API” - Did I just read that correctly?! :D

This is fantastic news Kai! Can’t wait to get an update on it!

1 Like

Soon ™️

It’s coming :)

3 Likes

It’s been a while since I made that request so I forget what exactly I wanted to do, but I think I was trying to calculate ETAs for flights using the waypoints in their flight plan at a scale of more than just one flight per request. I wanted to do this to get more accurate ETAs as going from point A to point B might not account for the in between difference. For example:

  • Straight line distance from EHAM to KATL is 3815nm.

  • With a more thought out flight plan, including waypoints, approaches, etc., this distance is closer 4000nm.

  • This could be scaled up to make the difference greater depending on the FPL

I guess, shortly put, I was looking for a way to calculate flight times more accurately. Of course this is not factoring in other variables such as wind and speed changes, but it’s a start. Maybe there is a better way of doing this?

Hi Ethan,
I was thinking about this problem, and I found the best solution would be to create a distance calculator for yourself with one of the existing great circle distance calculators. And this can be called for all waypoint pairs to calculate the distance almost accurately. I’m using the Haversine formula for calculation, not sure about which one IF uses, but it seems pretty accurate.

Here’s the link for my code (not really): afklm-bot-v2/distanceHelper.js at main · sanketpandia/afklm-bot-v2 · GitHub

I use this function to calculate distances more accurately

2 Likes

If you don’t mind me asking, why not just do this on-demand on a per-flight basis? It’s a fairly quick calculation, at least the ones Sanket has provided are.

1 Like

That brings me to another question Kai. The code for calculating distances that I have currently, don’t take into account the bulges of the earth. Would it be possible for you to share the formula used for the calculation between two coordinates in the Infinite Flight App?

Yes, that would work in most cases, but one case i’m thinking of in particular is getting a list of inbounds for an airport, then displaying that list with ETAs for each (even if only the top 10-20 were more accurately calculated). What I have now works just fine (calculating from point a to b with curvature taken into account), just was curious when I saw this topic open and you mentioning to add it to the board.

1 Like

Unfortunately that’s proprietary code, as we use our own algorithms that are specific to our use case. Any great circle formula should work. For instance, for the new version of LiveFlight we’re using ‘arc’ NPM package which is working fine.

1 Like

Just spoke to Cam about this. We’ve got an endpoint in our internal API that does what you’re after. Would you mind adding a Trello card with your exact use case (or link to this thread) and I’ll take a look when I get a chance.

2 Likes

Interesting and thanks a lot. Would check it out