cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Rest API Test For Completion

jhagist
New Contributor III

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?

1 ACCEPTED SOLUTION

jhagist
New Contributor III

Incredible. It was right in front of me all along. ๐Ÿ˜Ž

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)

image

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

image

Hopefully this wonโ€™t be as painful for you as it was for me!!

View solution in original post

12 REPLIES 12

You are welcomeโ€ฆ

jhagist
New Contributor III

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.

image

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.

image

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)

jhagist
New Contributor III

Incredible. It was right in front of me all along. ๐Ÿ˜Ž

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)

image

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

image

Hopefully this wonโ€™t be as painful for you as it was for me!!