Build a workflow to fetch order API and using sleep function to slow down the query speed to meet the rate limit

I am very happy to build a workflow to fetch order api from selling platform and save it to database, and show it on the the chart component.
It's so awesome, This used to take a lot of time.

Here is my demo showing.

First, use a resetApi to get an Access Token

Get all order and iterate all pages(if exists NextToken) and put them in one array. You can define a sleep function here to slow down the query speed to pass rate limit for some selling platform.

Get all orderItem for the orders


What surprise me here is workflow support Retry per literation which means if the query fails in that loop it will retry the single loop alone. it's so convinient.

add response block and save it to database

Click run workflow. And you can see in running time in run history

After the running is finish, all the data is upserted.
And the chart is automatically updated.

I could image what I can do with retool workflow in the future. it's so great tool. thanks.

1 Like