Skip to main content
3 of 6
added 52 characters in body

Combine multipage API results in Mathematica

Can't seem to find a good post/answer to this so I'm asking the question.

I'm pulling data from the Swarm/Foursquare API, and it's paged (max 250 results per pull):

url = StringTemplate["https://api.foursquare.com/v2/users/self/checkins?auth_token=`c`&limit=250&v=20220406"][<|"c" -> oauthToken|>]; checkins = Import[url, "RawJSON"] 

(in the above code, c is a variable that I populate outside the script)

In order to get additional data, I have to pull with the additional offset=250 parameter (or offset=500, &c.). The loop stops when the API query returns no items.

It's simple enough to compile multiple results in, say, PowerShell, Python, &c. My question is how would you combine the multiple pages in Wolfram to create a single data set? I'm having trouble getting this done.