Calling rest api endpoint in a loop and saving the results into a db

I am trying to call rest api endpoint in a loop lets say the endpoint is /api/pointInfo/ and result from this endpoint lets say some json data {'value': 10}. i want to save this into a database table which i already have something like point_values(name varchar, value jsonb). I tried using the loops but no look. I see only the first call is going through in the loop subsequent calls don't seem to be executing or see null value, more like Promise.all() seem to only do the first promise?


Hey Ram_Vaidyanathan,

It might be the case the endpoint is timing you out because of too many concurrent calls.

When you switch the loop to "Code" have you tried adding await before the labmda trigger?
image

Additionally, to be on safe side does the API return values if you just call 1 value?

Thanks that await helped, a follow up question, if I want to call another function and save the results into a database, what is the best way i can do that within the workflow?

Depending on your resource on success of these queries you could trigger an another one to save values to your database.

Hope that helps!