Waiting for an API request to complete26 Jan 2013 R API ropensci
Dealing with API tokens in R
In my previous post I showed an example of calling the Phylotastic taxonomic name resolution API
Taxosaurus here. When you query their API they give you a token which you use later to retrieve the result (see examples on their page above). However, you don’t know when the query will be done, so how do we know when to send the query to rerieve the data?
As the time this takes depends on how big the query is and other things, we don’t know when we can get the result. I struggled with this for a bit, but then settled on using a while loop.
So what does this look like? Basically we just keep sending the request for data until we get it.