<?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 Extract Hubspot API JSON data using tRESTClient and tLoop in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Extract-Hubspot-API-JSON-data-using-tRESTClient-and-tLoop/m-p/2314341#M85117</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt; 
&lt;P&gt;I have another thread open for this but I'm still looking for a solution.&lt;/P&gt; 
&lt;P&gt;I need to extract data from a Hubspot API using tRESTClient -&amp;gt; tMap -&amp;gt; tExtractJSONFields -&amp;gt; tAmazonAuroraOutput. This part I have working well. This challenge I'm trying to solve now is how to iterate through API calls based on data from the API prior call. There are 2 fields in the JSON output that can be used to determine if there are more records (API limits calls to 100 records): An 'offset' that indicates where the next call should start and 'hasmore' that indicates if there are more records available (true/false).&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I believe I need 2 jobs (parent &amp;amp; child). In the parent job initiate a loop (tLoop) and iterate over the subjob, which calls the API and extracts the JSON data, until in the subjob it encounters the hasmore = 'false'.&lt;/P&gt; 
&lt;P&gt;I have tried a variety of different configurations and it seems to all point to setting a gloabalMap variable that contains a java.util.concurrent.ConcurrentHashMap() and being able to modify that variable in the subjob and pass back to the parent to decide if another iteration should be fired off (hasmore = 'true) or stop processing (hasmore = 'false').&lt;/P&gt; 
&lt;P&gt;If anyone has done anything similar and can provide some guidance I would greatly appreciate it. It obviously doesn't need to be a Hubspot APi...just and API that needs to be called multiple times based on data from the API.&lt;/P&gt; 
&lt;P&gt;Here is an example of the demo data on Hubspot:&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo" target="_blank" rel="nofollow noopener noreferrer"&gt;https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 02 Nov 2017 21:18:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-11-02T21:18:33Z</dc:date>
    <item>
      <title>Extract Hubspot API JSON data using tRESTClient and tLoop</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Extract-Hubspot-API-JSON-data-using-tRESTClient-and-tLoop/m-p/2314341#M85117</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt; 
&lt;P&gt;I have another thread open for this but I'm still looking for a solution.&lt;/P&gt; 
&lt;P&gt;I need to extract data from a Hubspot API using tRESTClient -&amp;gt; tMap -&amp;gt; tExtractJSONFields -&amp;gt; tAmazonAuroraOutput. This part I have working well. This challenge I'm trying to solve now is how to iterate through API calls based on data from the API prior call. There are 2 fields in the JSON output that can be used to determine if there are more records (API limits calls to 100 records): An 'offset' that indicates where the next call should start and 'hasmore' that indicates if there are more records available (true/false).&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I believe I need 2 jobs (parent &amp;amp; child). In the parent job initiate a loop (tLoop) and iterate over the subjob, which calls the API and extracts the JSON data, until in the subjob it encounters the hasmore = 'false'.&lt;/P&gt; 
&lt;P&gt;I have tried a variety of different configurations and it seems to all point to setting a gloabalMap variable that contains a java.util.concurrent.ConcurrentHashMap() and being able to modify that variable in the subjob and pass back to the parent to decide if another iteration should be fired off (hasmore = 'true) or stop processing (hasmore = 'false').&lt;/P&gt; 
&lt;P&gt;If anyone has done anything similar and can provide some guidance I would greatly appreciate it. It obviously doesn't need to be a Hubspot APi...just and API that needs to be called multiple times based on data from the API.&lt;/P&gt; 
&lt;P&gt;Here is an example of the demo data on Hubspot:&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo" target="_blank" rel="nofollow noopener noreferrer"&gt;https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 21:18:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Extract-Hubspot-API-JSON-data-using-tRESTClient-and-tLoop/m-p/2314341#M85117</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-02T21:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Hubspot API JSON data using tRESTClient and tLoop</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Extract-Hubspot-API-JSON-data-using-tRESTClient-and-tLoop/m-p/2314342#M85118</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Could you please post your current work flow screenshots on forum which will be helpful for us to understand your job requirement?&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 07:47:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Extract-Hubspot-API-JSON-data-using-tRESTClient-and-tLoop/m-p/2314342#M85118</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-10T07:47:04Z</dc:date>
    </item>
  </channel>
</rss>

