Hi there,
I make a API request to a API that usually takes between 60 - 270 seconds to respond.
Is there a more elegant solution than mine? I am using a Repeater (3 times) and a Delay (90 sec).
It is working but, bad thing is that all 3 attempts are performed always. Even if already the status is set to “ready”, which means, the api ouput is there.
The API status is “in progress” while gathering information and then switches to “ready”, when finished.
Any idea?
API-Output is attached.
delay-output-of-api.txt (108.3 KB)
Thorsten
You can keep the wait module and add a break module on the http module.
Welcome to the Make community!
There are two methods if you want to do a polling wait in the same/single scenario.
Method 1 — difficulty level: Easy
The simplest solution would be to use a Sleep module to wait out 5 minutes (or the longest period that the external service takes).
You could even use more than one, if you have a Make subscription (free tier max 5 minutes per scenario run).
Method 2 — difficulty level: ???
This other method allows you to check multiple times at shorter intervals, because you “throw” an error to break from the repeater and end the scenario when successful/completed.
The secret is in the success check filter, the error handler, and the commit directive.
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.
After marking the solution in this thread I recognized, that its not the solution.
Crucial point is, that the first and the fourth http request module are requesting 2 different endpoints of the API.
The first request of the fourth http module just starts processing of the API. The API then switches to status “in progress”. If its finished, it states “ready”.
So, I found the solution. I just created 2 http requests for the same endpoint. Between both I put in a sleep-module of the longest duration. Thats it. So I always get a proper output after the waiting time.
Thanks for the right mental impulses.
1 Like