<?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: Custom code for v1 API (Lists) in Data Hub</title>
    <link>https://community.hubspot.com/t5/Data-Hub/Custom-code-for-v1-API-Lists/m-p/677782#M973</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/192045"&gt;@PBaxter&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I went through the github of the NodeJS API, but I can not discover a .ts file for the lists. The &lt;A href="https://github.com/HubSpot/hubspot-api-nodejs/tree/master/src/discovery/crm" target="_blank" rel="noopener"&gt;discovery&lt;/A&gt; folder is my go to place to check for all the available functions. But lists simply seem to be missing NodeJS API.&lt;BR /&gt;If you are familiar with &lt;A href="https://github.com/axios/axios" target="_blank" rel="noopener"&gt;Axios&lt;/A&gt;, you should be able to use that instead. Here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;const axios = require('axios');

const listData = await axios({
        method: 'get',
        url: `https://api.hubapi.com/contacts/v1/lists/1`,
        headers: {
          'Authorization': `Bearer ${process.env.authtoken}`,
          'Content-Type': 'application/json'
        }
      }).then(async (response) =&amp;gt; {
        console.log(response.data)
        return response.data
      }).catch((error) =&amp;gt; {
        console.log(`Error while getting list data: ${error.response.data.message}`)
        return null
      })&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Aug 2022 11:06:15 GMT</pubDate>
    <dc:creator>Teun</dc:creator>
    <dc:date>2022-08-09T11:06:15Z</dc:date>
    <item>
      <title>Custom code for v1 API (Lists)</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Custom-code-for-v1-API-Lists/m-p/677375#M972</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know the format to reference the v1 API from custom code with Node js? I'm trying to use the contact list API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For v3, the API URL to get contact info is something like:&lt;BR /&gt;/crm/v3/objects/contacts/2360301&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the equivalent js is:&lt;BR /&gt;hubspotClient.crm.contacts.basicApi.getById(item.id, .....) (where item.id = 2360301)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For v1, an example API URL is to get a list is:&lt;BR /&gt;/contactslistseg/v1/lists/1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I can't get the js equivalent to get data on list #1. Feels it should just be using hubSpotClient.contactslistseg.lists... but that&lt;BR /&gt;gives an undefined error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any ideas! Feels like I've tried every possible combination.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Phil&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 16:20:31 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Custom-code-for-v1-API-Lists/m-p/677375#M972</guid>
      <dc:creator>PBaxter</dc:creator>
      <dc:date>2022-08-08T16:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Custom code for v1 API (Lists)</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Custom-code-for-v1-API-Lists/m-p/677782#M973</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/192045"&gt;@PBaxter&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I went through the github of the NodeJS API, but I can not discover a .ts file for the lists. The &lt;A href="https://github.com/HubSpot/hubspot-api-nodejs/tree/master/src/discovery/crm" target="_blank" rel="noopener"&gt;discovery&lt;/A&gt; folder is my go to place to check for all the available functions. But lists simply seem to be missing NodeJS API.&lt;BR /&gt;If you are familiar with &lt;A href="https://github.com/axios/axios" target="_blank" rel="noopener"&gt;Axios&lt;/A&gt;, you should be able to use that instead. Here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;const axios = require('axios');

const listData = await axios({
        method: 'get',
        url: `https://api.hubapi.com/contacts/v1/lists/1`,
        headers: {
          'Authorization': `Bearer ${process.env.authtoken}`,
          'Content-Type': 'application/json'
        }
      }).then(async (response) =&amp;gt; {
        console.log(response.data)
        return response.data
      }).catch((error) =&amp;gt; {
        console.log(`Error while getting list data: ${error.response.data.message}`)
        return null
      })&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2022 11:06:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Custom-code-for-v1-API-Lists/m-p/677782#M973</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2022-08-09T11:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: Custom code for v1 API (Lists)</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Custom-code-for-v1-API-Lists/m-p/841268#M1764</link>
      <description>&lt;P&gt;For the older apis, you can use the apiRequest method via the hubspot js sdk. For instance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const response = await hubspotClient.apiRequest({
    method: 'get',
    path: '/contactslistseg/v1/lists/1',
})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See documentation &lt;A href="https://github.com/HubSpot/hubspot-api-nodejs/tree/master#get-contacts" target="_blank" rel="noopener"&gt;https://github.com/HubSpot/hubspot-api-nodejs/tree/master#get-contacts&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 16:35:04 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Custom-code-for-v1-API-Lists/m-p/841268#M1764</guid>
      <dc:creator>a_funs</dc:creator>
      <dc:date>2023-08-28T16:35:04Z</dc:date>
    </item>
  </channel>
</rss>

