Five Stars

output row value in tRest URL

My first REST call returns ID that I need to use in second REST call URL (GET request)2017-10-11_1308.png

 

I thought in URL I can do something like:

context.host + row2.id

or

context.host + globalMap.get("row2.id");

but I'm getting "row2 cannot be resolved to a variable" error.

 

How do I reference this "id" in tRest and other components?

 

Thanks,

Dima

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Seven Stars

Re: output row value in tRest URL

Replace tLogRow_3 with tSetGlobVar and capture the id in a variable
Example: your_variable_name=row2.id

Then You can reffer the id in next call using globalMap.get('your_variable_name')
8 REPLIES
Seven Stars

Re: output row value in tRest URL

Hi Dima,

 

Just add a tFlowToIterate immediately before your map, and you'll be able to reference row2.id.

 

Regards,

 

Chris

Five Stars

Re: output row value in tRest URL

Thanks, Chris. That helps iterate tRest but I get 'null' for my ID
Seven Stars

Re: output row value in tRest URL

Can you either use debug or drop a tLog in there to ensure you do actually have data in the field?

Five Stars

Re: output row value in tRest URL

It does return the correct ID

2017-10-11_1634.png

Seven Stars

Re: output row value in tRest URL

Can you show the entire job with the tFlowToIterate in place? Thanks.

Seven Stars

Re: output row value in tRest URL

Replace tLogRow_3 with tSetGlobVar and capture the id in a variable
Example: your_variable_name=row2.id

Then You can reffer the id in next call using globalMap.get('your_variable_name')
Five Stars

Re: output row value in tRest URL

That's it! Thanks a lot. I guess I can only reference "row2.id" in tMap but for components like tRest I need to declare a variable

Seven Stars

Re: output row value in tRest URL

If you want your job to run multiple restGET1+restGET2 then ,
You should propogate the rowX.id to a t FlowToIterate & then to restGeT2, as suggested by @ciw1973