Read the statement by Michael Teeuw here.
Multiple API Requests
-
I created a module that would display the estimated time of arrival (ETA) in a particular stop. But that can’t be done using a single API. Here is what I need
-
At start time I need to obtain the list of routes by calling an API
-
Every single minute for each route I need to collect the ETA for each route (Multiple API calls). And then update the grid accordingly.
I have done the first part but have no idea how to do the second part. Thanks for the help.
-
-
Well, of course you need two different functions or one function with multiple parameters.
Your first function fills an array with routes. Afterwards you check if this array is already set (and maybe if less than 24 hours passed) and if this is true you skip the first function but call the second function which fills another array of data. Your getDom checks both arrays and skips the ETA stuff until the array is filled.
-
Thanks for the reply.
I think my major question is, how can I make multiple asynchronous API calls (for obtaining the Stop info as well as obtaining the ETA for each route). Any example would be a great (pipe requests).
Thanks for the help.