how to iterate tRESTClient page number from Msql

Five Stars

how to iterate tRESTClient page number from Msql

hi,

 

I have an issue in my job,

I want to extract XML data using tRestClient, but i didn't understand how to iterate and change the page number at URL value in tRestClient

 

 

Untitled.png

 

for example, i want to iterate tRESTClient(page=1) -- tExtractXMLField, and repeat that job from tRESTClient with page=2 until max page, and value max page i recieved from query in Mysql database

 

Untitled3.png

 

 

 

Best Regards,

Jackson


Accepted Solutions
Six Stars

Re: how to iterate tRESTClient page number from Msql

Hey Jackson,

 

You can do something like this to iterate over the pages and construct the dynamic URL:
1.jpgIterate from the first to the last page2.jpgPut the current value to the globalMap3.jpgRead the actual value and construct the URL

Similar posts:

Also useful information from the GlobalMap: Talend globalMap Reference

 

Best,

Zoltán

 


All Replies
Twelve Stars

Re: how to iterate tRESTClient page number from Msql

You need manage URL - before tRESTClient

 

Screen Shot 2018-02-08 at 10.45.09 PM.png

 

when all prepared before - You are  have something similar to:

Screen Shot 2018-02-08 at 10.46.20 PM.png

 

also depending from Your API request, You must mange - is it last page or not? as example:

Screen Shot 2018-02-08 at 10.48.46 PM.png       Screen Shot 2018-02-08 at 10.48.59 PM.png

 

-----------
Six Stars

Re: how to iterate tRESTClient page number from Msql

Hey Jackson,

 

You can do something like this to iterate over the pages and construct the dynamic URL:
1.jpgIterate from the first to the last page2.jpgPut the current value to the globalMap3.jpgRead the actual value and construct the URL

Similar posts:

Also useful information from the GlobalMap: Talend globalMap Reference

 

Best,

Zoltán

 

Five Stars

Re: how to iterate tRESTClient page number from Msql


devxr wrote:

Hey Jackson,

 

You can do something like this to iterate over the pages and construct the dynamic URL:
1.jpgIterate from the first to the last page2.jpgPut the current value to the globalMap3.jpgRead the actual value and construct the URL

Similar posts:

Also useful information from the GlobalMap: Talend globalMap Reference

 

Best,

Zoltán

 


 thanks is working,

but how to make Number of row for row generator value dynamically, ex for the last page value it defined from my Query result in Mysql

Six Stars

Re: how to iterate tRESTClient page number from Msql

I'm glad that it worked! Smiley Happy
To answer your question: There are a lot of possibilities, but if we don't want to use custom code with tJava, I'd use the tLoop component to iterate over the pages and call a sequence from the tRest component, see below:

1.jpgQuery for the last page2.jpgStore it in the Global Map3.jpgIterate until the last page4.jpgUse a sequence for constructing the page numbers and increment by 1

See more from the Numeric Routines: https://help.talend.com/reader/qsVMGPxPzq7IQ_Tij2uz2g/37l7UbXMZlUCZF0w8t4DQw

 

 

Regards,

Zoltán