<?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 How can I read multiple pages from Harvest API in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-can-I-read-multiple-pages-from-Harvest-API/m-p/2354377#M120362</link>
    <description>&lt;P&gt;The Harvest API is a REST api. The results of a GET is a page of up to 2000 rows of data, plus some paging information including the total number of pages available, and a URL to retrieve the next page of data. That URL is null if there is not a next page. In order to use this API, I somehow have to feed that URL in the output schema back to the input of the tRest component so it can retrieve the next page. So how do I do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can get the first page with tRest, and extract the URL for the next page with tExtractJSONFields, but I can't determine how to tell Talend to get the next page. I don't know how many pages of data there are until I have read the first page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the link to Harvest API documentation: https://help.getharvest.com/api-v2/&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jul 2023 18:59:52 GMT</pubDate>
    <dc:creator>MarkM1</dc:creator>
    <dc:date>2023-07-20T18:59:52Z</dc:date>
    <item>
      <title>How can I read multiple pages from Harvest API</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-can-I-read-multiple-pages-from-Harvest-API/m-p/2354377#M120362</link>
      <description>&lt;P&gt;The Harvest API is a REST api. The results of a GET is a page of up to 2000 rows of data, plus some paging information including the total number of pages available, and a URL to retrieve the next page of data. That URL is null if there is not a next page. In order to use this API, I somehow have to feed that URL in the output schema back to the input of the tRest component so it can retrieve the next page. So how do I do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can get the first page with tRest, and extract the URL for the next page with tExtractJSONFields, but I can't determine how to tell Talend to get the next page. I don't know how many pages of data there are until I have read the first page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the link to Harvest API documentation: https://help.getharvest.com/api-v2/&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 18:59:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-can-I-read-multiple-pages-from-Harvest-API/m-p/2354377#M120362</guid>
      <dc:creator>MarkM1</dc:creator>
      <dc:date>2023-07-20T18:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can I read multiple pages from Harvest API</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-can-I-read-multiple-pages-from-Harvest-API/m-p/2354378#M120363</link>
      <description>&lt;P&gt;Hello @Mark Murphy​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suggest you use a tLoop component with "While" loop type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's an brief description of how to do it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, declare a global variable using tSetGlobalVar, let's say you call it "total_pages" and start it with 1 value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On tLoop component condition write    &lt;B&gt;i &amp;lt; ((Integer)globalMap.get("total_pages"))&lt;/B&gt;    , this way you'll guarantee that the loop will iterate at least once.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Connect tLoop to tRESTClient and map the API response total number of pages available to another tSetGlobalVar or a tJavaRow so you can update the "total_pages" variable on each execution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is just a brief example, you'll probably need to add other conditions o tLoop component to control the job flow.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 19:38:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-can-I-read-multiple-pages-from-Harvest-API/m-p/2354378#M120363</guid>
      <dc:creator>anselmopeixoto</dc:creator>
      <dc:date>2023-07-20T19:38:35Z</dc:date>
    </item>
  </channel>
</rss>

