Skip to main content
Question

Make the HTTPCaller stops when I have what I need

  • December 19, 2018
  • 6 replies
  • 11 views

philippeb
Enthusiast
Forum|alt.badge.img+20

Let's say I have 10 features and each of them has an URL that I can use within a HTTPCaller.

If I have what I need within the first URL though (validation made by a Tester just after), I want the HTTPCaller stop making calls.

How could I do that?

Thanks!

6 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • December 19, 2018

How about using a variableRetriever, tester on the value of the variable, httpCaller, tester on the results of the call, variableSetter if you have what you need.


david_r
Celebrity
  • December 20, 2018
If your http endpoint supports paging, you could wrap the HTTPCaller into a looping custom transformer that asks for e.g. successive blocks of 10 features, until you've found what you needed.

philippeb
Enthusiast
Forum|alt.badge.img+20
  • Author
  • Enthusiast
  • December 21, 2018
jdh wrote:

How about using a variableRetriever, tester on the value of the variable, httpCaller, tester on the results of the call, variableSetter if you have what you need.

I have to be honest with you, I've never used those variable transformers.

I've read the help documentation about them but I'm still confused how to use it.

I will try to find some examples here.

Happy Christmas!


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • December 21, 2018
philippeb wrote:

I have to be honest with you, I've never used those variable transformers.

I've read the help documentation about them but I'm still confused how to use it.

I will try to find some examples here.

Happy Christmas!

Here is a basic workspace illustrating the idea.

 

kb_HTTPCallerStop.fmw


philippeb
Enthusiast
Forum|alt.badge.img+20
  • Author
  • Enthusiast
  • December 21, 2018
jdh wrote:

Here is a basic workspace illustrating the idea.

 

kb_HTTPCallerStop.fmw

WoW ! Thanks a lot! I'll check this out early 2019 :D


mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • December 21, 2018

It did occur to me that there is a quicker solution, depending on what happens to the feature that passes the test. If it just goes on to transformers that are feature-based (i.e. it can be processed by itself) then you could simply end that stream with a Terminator transformer.

So the passing feature would get processed and then shut down the workspace, before other features get to the HTTPCaller.

Other than that, yes, I think variables or loops are the way forward (as much as it pains me to have to suggest variables - but at least this is a valid use of them!)

The only other way I can think of is to cause the HTTPCaller to reject features. For example if the response body is saved to a file, and the first passed feature could somehow set that file to read-only, then the rest of the HTTP calls would fail (they would still happen, but they would probably be output as Rejected, if that helps).


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings