<?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: Search Contact using Nodejs Library Call in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Search-Contact-using-Nodejs-Library-Call/m-p/394640#M39012</link>
    <description>&lt;P&gt;The offending line was&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;const query = 'test'&lt;/LI-CODE&gt;&lt;P&gt;Removing from publicObjectSearchRequest only the single line like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;query,&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;made the error go away, but it did not list the properties I requested, so I'll have to play some more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI, that line was exactly taken from the README.md under "{EXAMPLE} Search Contacts:" at &lt;A href="https://github.com/HubSpot/hubspot-api-nodejs" target="_blank" rel="noopener"&gt;https://github.com/HubSpot/hubspot-api-nodejs&lt;/A&gt;&amp;nbsp;so it would be nice to fix that so that example works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Phil&lt;/P&gt;</description>
    <pubDate>Fri, 18 Dec 2020 02:26:37 GMT</pubDate>
    <dc:creator>PCarlson</dc:creator>
    <dc:date>2020-12-18T02:26:37Z</dc:date>
    <item>
      <title>Search Contact using Nodejs Library Call</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-Contact-using-Nodejs-Library-Call/m-p/394313#M38960</link>
      <description>&lt;P&gt;I'm new to the API and using a modified version of the quickstart app from GitHub. I'm trying to find a contact by his email address and no matter what I try I get:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"total":0,"results":[]}&lt;/LI-CODE&gt;&lt;P&gt;I simplified it to search for a literal firstname and still no results. I see other people successfully searching, but all the answers are using curl rather than the library and using the API key rather than OAuth. I have OAuth working to get a token. I also have separately used curl with a v1 endpoint to successfully find a contact. But no luck with Nodejs api library and OAuth.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my function doing the search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;const getContactByEmail = async (accessToken, email_address) =&amp;gt; {
  console.log('');
  console.log('=== Retrieving a contact by email from HubSpot using the access token ===');

  const filter = { propertyName: 'firstname', operator: 'EQ', value: 'Brian' }
  const filterGroup = { filters: [filter] }
  const sort = 'firstname'
  const query = 'test'
  const properties = ['company', 'email', 'firstname', 'lastname']
  const limit = 100
  const after = 0
  
  const publicObjectSearchRequest = {
      filterGroups: [filterGroup],
      sorts: [sort],
      query,
      properties,
      limit,
      after
    };

  console.log(publicObjectSearchRequest)
  console.log(publicObjectSearchRequest.filterGroups[0].filters[0])
  const result = await hubspotClient.crm.contacts.searchApi.doSearch(publicObjectSearchRequest)
  console.log(JSON.stringify(result.body))
  return result.body
}&lt;/LI-CODE&gt;&lt;P&gt;And here is the console output:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=== Retrieving a contact by email from HubSpot using the access token ===
{
  filterGroups: [ { filters: [Array] } ],
  sorts: [ 'firstname' ],
  query: 'test',
  properties: [ 'company', 'email', 'firstname', 'lastname' ],
  limit: 100,
  after: 0
}
{ propertyName: 'firstname', operator: 'EQ', value: 'Brian' }
{"total":0,"results":[]}&lt;/LI-CODE&gt;&lt;P&gt;I tried the email_address parameter first. I also tried LTE and CONTAINS_TOKEN and other attempts all with the same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know what I'm missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Phil&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2020 03:06:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-Contact-using-Nodejs-Library-Call/m-p/394313#M38960</guid>
      <dc:creator>PCarlson</dc:creator>
      <dc:date>2020-12-17T03:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Search Contact using Nodejs Library Call</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-Contact-using-Nodejs-Library-Call/m-p/394400#M38969</link>
      <description>&lt;P&gt;I'm using the same api call, with only the filterGroup set.&amp;nbsp;&lt;BR /&gt;This is working perfect!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If you remove the&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorts, query, properties, limit, after&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From your publicObjectSearchRequest, is the call then working?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2020 11:59:11 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-Contact-using-Nodejs-Library-Call/m-p/394400#M38969</guid>
      <dc:creator>RMones</dc:creator>
      <dc:date>2020-12-17T11:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Search Contact using Nodejs Library Call</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-Contact-using-Nodejs-Library-Call/m-p/394638#M39011</link>
      <description>&lt;P&gt;Thanks RMones, that worked! I gave you an upvote and I'll accept your post as solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any additional info on why I cannot have the other options and why it does not work with all options (I took this straight from the GitHub sample and only modified the filter)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll experiment and see which breaks it, but any tips on what's going on, what combinations work and what doesn't work are very welcome!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2020 01:56:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-Contact-using-Nodejs-Library-Call/m-p/394638#M39011</guid>
      <dc:creator>PCarlson</dc:creator>
      <dc:date>2020-12-18T01:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: Search Contact using Nodejs Library Call</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Search-Contact-using-Nodejs-Library-Call/m-p/394640#M39012</link>
      <description>&lt;P&gt;The offending line was&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;const query = 'test'&lt;/LI-CODE&gt;&lt;P&gt;Removing from publicObjectSearchRequest only the single line like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;query,&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;made the error go away, but it did not list the properties I requested, so I'll have to play some more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI, that line was exactly taken from the README.md under "{EXAMPLE} Search Contacts:" at &lt;A href="https://github.com/HubSpot/hubspot-api-nodejs" target="_blank" rel="noopener"&gt;https://github.com/HubSpot/hubspot-api-nodejs&lt;/A&gt;&amp;nbsp;so it would be nice to fix that so that example works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Phil&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2020 02:26:37 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Search-Contact-using-Nodejs-Library-Call/m-p/394640#M39012</guid>
      <dc:creator>PCarlson</dc:creator>
      <dc:date>2020-12-18T02:26:37Z</dc:date>
    </item>
  </channel>
</rss>

