Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Jayesh47
Contributor II
Contributor II

tRestClient URL loop

Hi There,

Need help in looping the URL added to tRestClient.

sample URL: 

/api/v3/projects/5582/test-runs/723678/test-logs?page=1&pageSize=1

Need to loop through page 1 to n.

Note - not able to loop via tLoop as it is not allowing as an input to tRestClient

Rest flow is working fine, just need help in looping the URL.

Thanks

Labels (1)
  • Other

2 Solutions

Accepted Solutions
Shicong_Hong
Support
Support

Hi

You can add a tJava component between tLoop and tRestClient, eg:

tLoop--iterate--tJava--oncomponentok--tRestClient

On tJava, you can build the URL with current value and assign it to a context variable for used later on tRestClient. 

context.URL="/api/v3/projects/5582/test-runs/723678/test-logs?page="+((Integer)globalMap.get("tLoop_1_CURRENT_VALUE"))+"&pageSize=1";

 

View solution in original post

Shicong_Hong
Support
Support

Context.url is a context variable, you need to define a context variable called url in the Context viewer. 

 

View solution in original post

3 Replies
Shicong_Hong
Support
Support

Hi

You can add a tJava component between tLoop and tRestClient, eg:

tLoop--iterate--tJava--oncomponentok--tRestClient

On tJava, you can build the URL with current value and assign it to a context variable for used later on tRestClient. 

context.URL="/api/v3/projects/5582/test-runs/723678/test-logs?page="+((Integer)globalMap.get("tLoop_1_CURRENT_VALUE"))+"&pageSize=1";

 

Jayesh47
Contributor II
Contributor II
Author

i have passed context.url, but it is not picking in the URL field of trest, throwing error stating url cannot be resolved. i also have a bearer token to pass which i have added to header of trest.

can you please share some tutorial, not sure why they closed talend community and integrated it here its quite difficult o find any exiting questions

Shicong_Hong
Support
Support

Context.url is a context variable, you need to define a context variable called url in the Context viewer.