How to optimize calls to multiple APIs at once and return as one set?
Posted
by
Martin
on Programmers
See other posts from Programmers
or by Martin
Published on 2013-03-01T14:22:05Z
Indexed on
2013/10/22
4:07 UTC
Read the original article
Hit count: 244
I have a web app that searches across 2 APIs right now. I have my own Restful web service that I call, and it does all the work on the backend to asynchronously call the 2 APIs and concatenate them into one result set for my web app to use.
I want to scale this out and add as many other APIs as I can (currently looking at about 10 more). But as I add APIs, the call to my service gets (potentially) slower and more complex. How do I handle one API not responding ... and other issues that arise?
What would be the best way to approach this? Should I create a service call for each API, that way each one is independent and not coupled to all the other calls? Is there a way on the backend to handle the multiple API calls without all the extra complexity it adds?
If I go the route of a service call per API, now my client code gets more complex (and I have a lot of clients)? And it's more work for the client, and since I have mobile apps, it will cost the client more data usage.
If I go one service call, is there a way to set up some sort of connection so I can return data as I get it, in case one service call hangs?
© Programmers or respective owner