Rest API Test For Completion

I have a pattern where I run a REST POST api call and then need to run a REST GET to see if the request has completed. I need to somehow loop back to run the REST GET again if it isn’t done.

Recommendations on how to handle this pattern?

Use REST Get in a Child Pipeline and Call it Via Pipline Execute.

Ok… I am a bit confused. So I need to follow this pattern.

Rest Post request data
Rest Get to see if it has completed.

So in the scenario that the Rest Get returns it isn’t done, I run my wait script (Python) but how to I run to the GET again?

Thanks for you response!

Use Union Snap before REST GET which will have 2 inputs and after GET Place Script and a router(If required. To go futher or loop back) and route back to REST Get Via Union Snap.
image

1 Like

Perfect! Worked like a charm.

Thanks for the picture!

1 Like

You are welcome…

ok this is weird. When I put it in my pipeline I am getting this error message.

Pipeline failed to prepare

Reason: java.lang.StackOverflowError

Resolution: Please address the reported error

The snap it is failing on is not in the loop section at all. It is the directory browser.

Has anyone seen this and what is the fix. Also if I break the router and union connection. It works.

I had that error too…

I was intrigued by the looping logic mentioned in the thread above because I had never seen or thought about doing something like that. But when I put together a simple pipeline to try and test it out (see below) I get the same StackOverflowError when trying to run or validate the pipeline.

As far as the snap it is failing on, I think it just mentions the first snap, but really failed trying to prepare the pipeline, not necessarily with the first snap…

The way to address this one is to use the REST GET Snap, and use the HAS NEXT functionality. You can make it iterate until the correct response is received.
(You may not have a loop in a pipeline)

Incredible. It was right in front of me all along. :sunglasses:

So here are the pictures.

This is the API response. (in this case I need status = success. It tells me I can go get the data)

This is how I set up the Rest GET Snap. I have Has next set to try again if status <> success.

Hopefully this won’t be as painful for you as it was for me!!

1 Like

So aside from the REST GET snap that happens to have it’s own built-in next/loop within the snap itself, is there a recommended pattern for achieving a “while” type of loop within a pipeline? That’s the piece I was excited about from some of the examples when this thread started off, and sounded like more than one person somehow had it working. Interested in people’s tricks.

Not sure that this is what you are looking for but it looks promising.

Retry Snap

Wondering if anyone has used this? What was your use case?