Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
spook2020202
Contributor III
Contributor III

Getting data from a REST endpoint using a loop

Hi,

I'm having trouble getting data from a rest endpoints using a loop.
What I'm doing is calling an endpoint which returns a list of football leagues:
image.png

Once it has this data, what im trying to do is loop through each item in the list, and for each one, query a different endpoint using the league_id. So using the table above, i would expect it to call the endpoints 20 times which would get all of the matches for each of the leagues.
The endpoints has some headers that need to be added to the call but the only "dynamic" part of the request is a query param. eg:

https://api-football-v1.p.rapidapi.com/v2/fixtures/league/<league_id_from_table>

EG:
https://api-football-v1.p.rapidapi.com/v2/fixtures/league/5

Is anyone able to assist or provide an example of looping through a table and making a rest call with headers?

Thanks 

Labels (2)
1 Solution
2 Replies
spook2020202
Contributor III
Contributor III
Author

Exactly what i needed. Thanks.