Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
kevin91
Contributor
Contributor

iterate rest call then make another rest call based on first rest call

I have a list of userID variables I need to do a rest call on to get the sessionID

If the userID exists, it returns a sessionID --> Rest call using the sessionID to update that session 

if it doesnt, I need to create the session -->Rest call using the userID to create new session 

 

example:

I have ids {1, 2, 3}

iterate rest call, tREST: GET url: "www.rest.com/" + input_row.id

I either get a 404 or 200, 200 has id2 in it I need for next rest call

was going to put those in a hashmap like <id, id2> and put those on globalMap ?

then itereate on globalMap.newHashMap

if id2 is null, do tREST_2

else do tREST_3 with id2 variable

 

so was thinking tFlowToIterate_1 --> tREST_1 --> tExtractJSONFields (to get the id2) --> tJavaRow (create hashmap) --> tFlowToItereate_2 --> if id2 === null, do tREST_2...Else do tREST_3

 

Does that make sense? I am having trouble with the data flow and mapping what I get back from tREST_1 with the inputs I am putting in.

And also with the IF between deciding which of the 2 REST calls i do

 

thanks so much, I am pretty new to talend, but understand java very well, just trying to understand the flow of variables better

Labels (5)
1 Reply
Anonymous
Not applicable

Hello,

If I understand your requirement very well, you can use tContextLoad or Implicit tContextLoad to iterate a list of userID variables in  a flat file and set a Context value in tRest URL parameter.

Here is a related topic:https://community.talend.com/t5/Design-and-Development/resolved-Iterate-through-a-list-of-URL-s-for-...

Let us know if it is what you are looking for.

Best regards

Sabrina