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

Four Stars

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