Four 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

1 ACCEPTED SOLUTION

Accepted Solutions
Five 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:
Iterate from the first to the last pageIterate from the first to the last pagePut the current value to the globalMapPut the current value to the globalMapRead the actual value and construct the URLRead the actual value and construct the URL

Similar posts:

Also useful information from the GlobalMap: Talend globalMap Reference

 

Best,

Zoltán

 

4 REPLIES
Ten 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

 

-----------
Five 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:
Iterate from the first to the last pageIterate from the first to the last pagePut the current value to the globalMapPut the current value to the globalMapRead the actual value and construct the URLRead the actual value and construct the URL

Similar posts:

Also useful information from the GlobalMap: Talend globalMap Reference

 

Best,

Zoltán

 

Four 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:
Iterate from the first to the last pageIterate from the first to the last pagePut the current value to the globalMapPut the current value to the globalMapRead the actual value and construct the URLRead 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

Five 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:

Query for the last pageQuery for the last pageStore it in the Global MapStore it in the Global MapIterate until the last pageIterate until the last pageUse a sequence for constructing the page numbers and increment by 1Use 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