Skip to main content
Solved

How to recursively call HTTP connector?


Freddy
Forum|alt.badge.img+16
  • Thinkwise Local Partner Brasil
  • 531 replies

For our demo App we are utilizing API's that have to be called per row. So we have 28 states and to get my data I want to have a solution that checks which data is missing and then automatically fetches this data per state in this case. Same goes for a company with multiple locations… how do i get my App to automatically get all the coordinates for these locations? 

Basically a cursor for the HTTP connector. I've tried another solution in the community to go to the first row and then cycle to the last.. but it didn't work because the key values are not passed on and secondly it's a GUI action so the user has to wait until the GUI visually went through all the locations. 

Any suggestions on how I can subsequently invoke a http connector based on a query result?

Best answer by Mark Jongeling

In the decision process action you can define when a HTTP call should be done. If you only want the companies for which information is missing, then you can write a query like this (pseudo-code):

select top 1
    @company_id = company_id,
    @region_id = region_id
from company
where company_image is null --This is missing and should be obtained via HTTP call

if @company_id is not null and @region_id is not null
begin
    set @url = 'https://servicodados.ibge.gov.br/api/v3/malhas/estados/'+@region_id

    set @decision_http_connector = 1 -- Go do this process step
    set @decision_stop = 0 -- Do not stop
end

Does this help or am I not fully aware of the context and the complexity?

View original
Did this topic help you find an answer to your question?
This topic has been closed for replies.

5 replies

Freddy
Forum|alt.badge.img+16
  • Author
  • Thinkwise Local Partner Brasil
  • 531 replies
  • April 7, 2022

Cannot edit, but I mean recursively in the background. I can loop back and keep looping and then give a stop, but it all goes through the GUI. Can it be processed in the background? 


Mark Jongeling
Administrator
Forum|alt.badge.img+23

Hi Freddy,

You can loop the HTTP connector onto itself; or (my preference) have a decision node that decides whether or not the HTTP connector should be executed. After the decision has decided it should go to the HTTP connector next, after the HTTP connector it should go back to that same decision.

That decision then looks (again) if it needs to go to the HTTP connector, if not, the flow can end.

Flow:

Start -> [decision <-> http connector]{loop} -> end

(I can add an example tomorrow if the text is not sufficient :) )

Bonus points, it can also be a scheduled system flow 


Freddy
Forum|alt.badge.img+16
  • Author
  • Thinkwise Local Partner Brasil
  • 531 replies
  • April 7, 2022
Mark Jongeling wrote:

Hi Freddy,

You can loop the HTTP connector onto itself; or (my preference) have a decision node that decides whether or not the HTTP connector should be executed. After the decision has decided it should go to the HTTP connector next, after the HTTP connector it should go back to that same decision.

That decision then looks (again) if it needs to go to the HTTP connector, if not, the flow can end.

Flow:

Start -> [decision <-> http connector]{loop} -> end

(I can add an example tomorrow if the text is not sufficient :) )

Bonus points, it can also be a scheduled system flow 

I have something similar.. it just goes back to the initial task and the task doesn't do anything until in this case al geo locations are fetched.. the problem is that it stays in te foreground.. I would like it in the background.  

I think a system flow will not work.. because I don't want to get 80 million geo locations.. (I will be broke :)) ..   The idea is that if a company is found, it will fetch the geo locations of the active subsidiaries. 

 


Mark Jongeling
Administrator
Forum|alt.badge.img+23
  • Administrator
  • 3945 replies
  • Answer
  • April 8, 2022

In the decision process action you can define when a HTTP call should be done. If you only want the companies for which information is missing, then you can write a query like this (pseudo-code):

select top 1
    @company_id = company_id,
    @region_id = region_id
from company
where company_image is null --This is missing and should be obtained via HTTP call

if @company_id is not null and @region_id is not null
begin
    set @url = 'https://servicodados.ibge.gov.br/api/v3/malhas/estados/'+@region_id

    set @decision_http_connector = 1 -- Go do this process step
    set @decision_stop = 0 -- Do not stop
end

Does this help or am I not fully aware of the context and the complexity?


Freddy
Forum|alt.badge.img+16
  • Author
  • Thinkwise Local Partner Brasil
  • 531 replies
  • April 8, 2022

@Mark Jongeling yes it's indeed something like this. I never used the decision action, but it's a nice one because that one doesn't lead to any interaction in the GUI. So I created it as follows:

  • One task to kick the geo-location off, it registers are establishments of a company. 
  • Next it goes to a decision node, which basically does what you proposed, it checks if there are any missing geo locations and if so, it serves the addresses to search to the HTTP connector. 
  • The loop will stop when there are no missing geo locations left. 

 

 

 


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