'Continually call an API till data are available
An api can give me two types of response in json.
Response 1:
{
"status": "In Progress",
"message": "Dataset is not ready yet, try again in XXs"
}
Response 2
[
{
"data": "..."
},
{
"data": "..."
}
]
It may take the api several hours to finally have the data ready and give me the second response.
What is an optimal way to check whether the first response was generated and if so wait for some time till i call the api again till i finally get the second response?
I thought of checking whether the string starts with '{' or '[' but that does not seem to be the best way.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
