Best way to keep running a 'job status' API until you get a 'success' status

Hi All,

I’m building a server action with a number of google cloud based APIs in it. One of the APIs needs to go off and run some processes that can take a few seconds (or more) until its complete.

The way the google APIs work is that they immediately return the API call with a ‘RUNNING’ status and a JobID among some other data.

You then use that JobID to run a GET API on the Job Info, which will return the status of the Job. i.e. in a few seconds it will be ‘DONE’

What’s the best way to continue to run the Job status API until the status returns DONE and then move on to the next steps in the server connect file?

The schema is defined and I can set a value for the job ID and the job status… but I can’t figure out how to best use the WHILE, CONDITION or REPEAT steps to get it to work how I’d like.

Thoughts?

Managed t get this working. Was just having issues setting and re-setting a value both inside and outside a repeat/while loop.

The key (for me at least) was using the SetSession step:

image

And then using that in a While step.

It worked fine, but I think i’ll need to consider some sort of error handling. In that if there is an error in the API, and it never reaches the status done, then this will be in a never ending loop.

Any thoughts on that?