<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Loop through different api calls with pagination in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Loop-through-different-api-calls-with-pagination/m-p/2331917#M100853</link>
    <description>&lt;P&gt;OK, you are practically there with this, but I think you need to make a change to how you deal with your tokens. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have a tLoop iterating over the pagination, that should be done for each token to completion before switching token. For this, I think you should set up a tFixedFlowInput (with your token data), connect that to a tFlowToIterate and connect that to your tJava_1 which initiates your variables for the tLoop. What this will do is cycle through your tokens and for each token it will run the tLoop to completion. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a quick example of what I meant, see below...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z0F3yAAF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157249i505522AFB05808BB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z0F3yAAF.png" alt="0695b00000Z0F3yAAF.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Nov 2022 11:01:25 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-11-08T11:01:25Z</dc:date>
    <item>
      <title>Loop through different api calls with pagination</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Loop-through-different-api-calls-with-pagination/m-p/2331916#M100852</link>
      <description>&lt;P&gt;I'm trying to retrieve data out of an api calls with different tokens (credentials), each token represent a different division. The api has a limit of row per page which is why is paginated. So far my job extract the data out of the API looping through the pages until record count is 0, but is only working for 1 token and I have 6 different tokens, so if I add another token it should retrieve all records for token 1 and then continue to token 2, etc... So the only thing remaining is loop through each token but making sure it retrieve all records for each token.&lt;/P&gt;&lt;P&gt;Below is my job:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z04OlAAJ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155889iF60CF18E8AFD5ADA/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z04OlAAJ.png" alt="0695b00000Z04OlAAJ.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tjava_1 code:&lt;/P&gt;&lt;P&gt;globalMap.put("page",new Integer("1"));&lt;/P&gt;&lt;P&gt;globalMap.put("enddata", new Boolean(true));&lt;/P&gt;&lt;P&gt;Tloop_1:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z04NKAAZ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/147273iE1022DAFE8900F38/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z04NKAAZ.png" alt="0695b00000Z04NKAAZ.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tFixedFlowInput_1, here is where I put all different tokens but like I explained above if I use 1 it works perfect but if I put more than 1 it doesn't work:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z04RLAAZ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157902i17F09ECE9D5164DC/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z04RLAAZ.png" alt="0695b00000Z04RLAAZ.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tJavaRow_1:&lt;/P&gt;&lt;P&gt;globalMap.put("Token", new String(row1.Token));&lt;/P&gt;&lt;P&gt;globalMap.put("Division", new String(row1.Division));&lt;/P&gt;&lt;P&gt;System.out.println("Token: " + globalMap.get("Token"));&lt;/P&gt;&lt;P&gt;System.out.println("Division: " + globalMap.get("Division"));&lt;/P&gt;&lt;P&gt;tFlowToIterate_2:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z04SsAAJ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/152485i263A2359904079E2/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z04SsAAJ.png" alt="0695b00000Z04SsAAJ.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tREST_2:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z04TgAAJ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134591iF8B6BF1987AD0C21/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z04TgAAJ.png" alt="0695b00000Z04TgAAJ.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tExtractJSONFields_6:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z04UZAAZ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/153273i8C3FCEF8F6148D18/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z04UZAAZ.png" alt="0695b00000Z04UZAAZ.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tJavaRow_6:&lt;/P&gt;&lt;P&gt;System.out.println(row21.count);&lt;/P&gt;&lt;P&gt;globalMap.put("page",(Integer)globalMap.get("page")+1);&lt;/P&gt;&lt;P&gt;if(row21.count == null || row21.count == 0)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt; globalMap.put("enddata", new Boolean(false));&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt;This is the result I get when I use 1 token in the tFixedFlowInput_1, which works as expected:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z04WfAAJ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/148254i47BF2E1BBC422072/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z04WfAAJ.png" alt="0695b00000Z04WfAAJ.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the result if I add 2 or more tokens, which is what I want to resolve. Instead of doing this it should loop all pages for token 1 until there are no records and then continue with token 2 and so on...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z04iHAAR.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/149527iAF90A9978F88C5D6/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z04iHAAR.png" alt="0695b00000Z04iHAAR.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be greatly appreciated!!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 22:23:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Loop-through-different-api-calls-with-pagination/m-p/2331916#M100852</guid>
      <dc:creator>MBI1667841504</dc:creator>
      <dc:date>2024-11-15T22:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through different api calls with pagination</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Loop-through-different-api-calls-with-pagination/m-p/2331917#M100853</link>
      <description>&lt;P&gt;OK, you are practically there with this, but I think you need to make a change to how you deal with your tokens. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have a tLoop iterating over the pagination, that should be done for each token to completion before switching token. For this, I think you should set up a tFixedFlowInput (with your token data), connect that to a tFlowToIterate and connect that to your tJava_1 which initiates your variables for the tLoop. What this will do is cycle through your tokens and for each token it will run the tLoop to completion. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a quick example of what I meant, see below...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z0F3yAAF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157249i505522AFB05808BB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z0F3yAAF.png" alt="0695b00000Z0F3yAAF.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2022 11:01:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Loop-through-different-api-calls-with-pagination/m-p/2331917#M100853</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-08T11:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through different api calls with pagination</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Loop-through-different-api-calls-with-pagination/m-p/2331918#M100854</link>
      <description>&lt;P&gt;This approach is working.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2022 13:44:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Loop-through-different-api-calls-with-pagination/m-p/2331918#M100854</guid>
      <dc:creator>MBI1667841504</dc:creator>
      <dc:date>2022-11-08T13:44:10Z</dc:date>
    </item>
  </channel>
</rss>

