Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
Best Regards,
Jackson
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 page
Put the current value to the globalMap
Read the actual value and construct the URL
Similar posts:
Also useful information from the GlobalMap: Talend globalMap Reference
Best,
Zoltán
You need manage URL - before tRESTClient
when all prepared before - You are have something similar to:
also depending from Your API request, You must mange - is it last page or not? as example:
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 page
Put the current value to the globalMap
Read the actual value and construct the URL
Similar posts:
Also useful information from the GlobalMap: Talend globalMap Reference
Best,
Zoltán
@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 page
Put the current value to the globalMap
Read the actual value and construct the URL
Similar posts:
- https://community.talend.com/t5/Design-and-Development/resolved-tRest-Talend-with-dynamic-URL-and-pa...
- https://community.talend.com/t5/Design-and-Development/resolved-TOS-REST-client-iteratating-and-pars...
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
I'm glad that it worked!
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 page
Store it in the Global Map
Iterate until the last page
Use 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
@vapukov: Is there any way you can share code for this or share screenshot for each component what value you configured?
I have exactly same thing and I am getting stuck at various components with different errors.
Would really appreciate if you can share please.
Thanks
Harshal.