<?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 Problem with API contacts search using php client library in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/575002#M50846</link>
    <description>&lt;P&gt;Hi, I'm afraid this is going to be a n00b question but I can figure out what I'm doing wrong.&amp;nbsp; I would like to pull a list of contacts that have been modified after $date.&amp;nbsp; Seems easy enough, right?&amp;nbsp; Going thru the docs I find the search endpoint in the crm section of the v3 API (&lt;A href="https://developers.hubspot.com/docs/api/crm/contacts)" target="_blank"&gt;https://developers.hubspot.com/docs/api/crm/contacts)&lt;/A&gt; and copy the code into my IDE.&amp;nbsp; I make some modifications to hopefully only return contacts modified after 31 January and try running the script.&amp;nbsp; Unfortunately, there seems to be a syntax error in the code from docs page (I get an error when running it from there as well) and my "skills" are lacking when it comes to finding it.&amp;nbsp; My code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;use HubSpot\Factory;&lt;BR /&gt;use HubSpot\Client\Crm\Contacts\ApiException;&lt;/P&gt;&lt;P&gt;$client = Factory::createWithApiKey("68153de2-75f0-4aa0-b35b-28bc1a4dd82f");&lt;/P&gt;&lt;P&gt;$PublicObjectSearchRequest = new PublicObjectSearchRequest(['filter_groups' =&amp;gt; [{"filters":[{"value":"2022-01-31","propertyName":"lastmodifieddate","operator":"GT"}]}], 'sorts' =&amp;gt; ["DESCENDING"], 'properties' =&amp;gt; ["ALL"], 'limit' =&amp;gt; 20, 'after' =&amp;gt; 0]);&lt;BR /&gt;try {&lt;BR /&gt;$apiResponse = $client-&amp;gt;crm()-&amp;gt;contacts()-&amp;gt;searchApi()-&amp;gt;doSearch($PublicObjectSearchRequest);&lt;BR /&gt;var_dump($apiResponse);&lt;BR /&gt;} catch (ApiException $e) {&lt;BR /&gt;echo "Exception when calling search_api-&amp;gt;do_search: ", $e-&amp;gt;getMessage();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My IDE and server logs are telling me that the error is the curly brace before "filters", ie&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PublicObjectSearchRequest(['filter_groups' =&amp;gt; [&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;"filters":[{"value"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried working with the braces and brackets, but this syntax is foreign to me and I cannot find the right combination.&amp;nbsp; Any help/point in the right direction is greatly appreciated.&lt;/P&gt;</description>
    <pubDate>Sat, 12 Feb 2022 15:34:27 GMT</pubDate>
    <dc:creator>JNichel</dc:creator>
    <dc:date>2022-02-12T15:34:27Z</dc:date>
    <item>
      <title>Problem with API contacts search using php client library</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/575002#M50846</link>
      <description>&lt;P&gt;Hi, I'm afraid this is going to be a n00b question but I can figure out what I'm doing wrong.&amp;nbsp; I would like to pull a list of contacts that have been modified after $date.&amp;nbsp; Seems easy enough, right?&amp;nbsp; Going thru the docs I find the search endpoint in the crm section of the v3 API (&lt;A href="https://developers.hubspot.com/docs/api/crm/contacts)" target="_blank"&gt;https://developers.hubspot.com/docs/api/crm/contacts)&lt;/A&gt; and copy the code into my IDE.&amp;nbsp; I make some modifications to hopefully only return contacts modified after 31 January and try running the script.&amp;nbsp; Unfortunately, there seems to be a syntax error in the code from docs page (I get an error when running it from there as well) and my "skills" are lacking when it comes to finding it.&amp;nbsp; My code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;use HubSpot\Factory;&lt;BR /&gt;use HubSpot\Client\Crm\Contacts\ApiException;&lt;/P&gt;&lt;P&gt;$client = Factory::createWithApiKey("68153de2-75f0-4aa0-b35b-28bc1a4dd82f");&lt;/P&gt;&lt;P&gt;$PublicObjectSearchRequest = new PublicObjectSearchRequest(['filter_groups' =&amp;gt; [{"filters":[{"value":"2022-01-31","propertyName":"lastmodifieddate","operator":"GT"}]}], 'sorts' =&amp;gt; ["DESCENDING"], 'properties' =&amp;gt; ["ALL"], 'limit' =&amp;gt; 20, 'after' =&amp;gt; 0]);&lt;BR /&gt;try {&lt;BR /&gt;$apiResponse = $client-&amp;gt;crm()-&amp;gt;contacts()-&amp;gt;searchApi()-&amp;gt;doSearch($PublicObjectSearchRequest);&lt;BR /&gt;var_dump($apiResponse);&lt;BR /&gt;} catch (ApiException $e) {&lt;BR /&gt;echo "Exception when calling search_api-&amp;gt;do_search: ", $e-&amp;gt;getMessage();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My IDE and server logs are telling me that the error is the curly brace before "filters", ie&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PublicObjectSearchRequest(['filter_groups' =&amp;gt; [&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;"filters":[{"value"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried working with the braces and brackets, but this syntax is foreign to me and I cannot find the right combination.&amp;nbsp; Any help/point in the right direction is greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Feb 2022 15:34:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/575002#M50846</guid>
      <dc:creator>JNichel</dc:creator>
      <dc:date>2022-02-12T15:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with API contacts search using php client library</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/575007#M50847</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/330164"&gt;@JNichel&lt;/a&gt;&amp;nbsp;Hubspot uses Unix timestamp in milliseconds for date value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So instead if “2022-01-31” use&amp;nbsp;&lt;SPAN&gt;1643598000000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this is helpful.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Feb 2022 15:40:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/575007#M50847</guid>
      <dc:creator>Ismail</dc:creator>
      <dc:date>2022-02-12T15:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with API contacts search using php client library</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/575016#M50848</link>
      <description>&lt;P&gt;Hi Ismail, that is helpful going forward, but it didn't solve the syntax issue, "syntax error, unexpected '{', expecting ']'", right before filters.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Feb 2022 15:59:58 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/575016#M50848</guid>
      <dc:creator>JNichel</dc:creator>
      <dc:date>2022-02-12T15:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with API contacts search using php client library</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/575033#M50851</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/330164"&gt;@JNichel&lt;/a&gt;&amp;nbsp;I think the property name is "&lt;SPAN&gt;hs_lastmodifieddate"&lt;/SPAN&gt;&lt;BR /&gt;This works on postman&lt;BR /&gt;&lt;SPAN&gt;POST: &lt;A href="https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=&lt;/A&gt;&amp;lt;yourapikey&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;"filterGroups"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;"filters"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;"value"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"1643598000000"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;"propertyName"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"hs_lastmodifieddate"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;"operator"&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"GT"&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Sat, 12 Feb 2022 17:13:53 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/575033#M50851</guid>
      <dc:creator>Ismail</dc:creator>
      <dc:date>2022-02-12T17:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with API contacts search using php client library</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/575895#M50889</link>
      <description>&lt;P&gt;Ismail, I appreciate your response, but according to the docs here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.hubspot.com/docs/api/crm/search" target="_blank"&gt;https://developers.hubspot.com/docs/api/crm/search&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The property I'm looking to search on for &lt;STRONG&gt;contacts&lt;/STRONG&gt; is lastmodifieddate.&amp;nbsp; The example you're showing is for &lt;STRONG&gt;deals&lt;/STRONG&gt;.&amp;nbsp; I understand that it may work in different areas and/or languages, but I'm trying to use the HubSpot provided PHP SDK (&lt;A href="https://developers.hubspot.com/docs/api/overview" target="_blank"&gt;https://developers.hubspot.com/docs/api/overview&lt;/A&gt;) so that I can spend more time working with the data instead of writing my own tools.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I copied the example from the search endpoint here &lt;A href="https://developers.hubspot.com/docs/api/crm/contacts" target="_blank"&gt;https://developers.hubspot.com/docs/api/crm/contacts&lt;/A&gt; but that is what is throwing the syntax error.&amp;nbsp; It throws an error when you try to test the example on their own site.&amp;nbsp; The other parts of the PHP SDK that I've used work fine, so I just wrote something using cURL for the search endpoint until a fix is in place.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 19:18:16 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/575895#M50889</guid>
      <dc:creator>JNichel</dc:creator>
      <dc:date>2022-02-14T19:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with API contacts search using php client library</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/576950#M50927</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/330164"&gt;@JNichel&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would spend some time practicing with PHP arrays. This error is telling you you're trying to mix objects with multidimensional arrays. You are also not allowed to use colons as assignment operators in PHP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In short, replace all of those {} with [] and colons with "=&amp;gt;".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RBThomas_0-1644980729272.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/59639i70BCCCDD69311263/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RBThomas_0-1644980729272.png" alt="RBThomas_0-1644980729272.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. I have found that the PHP SDK is not intuitive. Instead, I wrote my own cURL wrapped functions to handle data with HubSpot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope that helps!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 09:50:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/576950#M50927</guid>
      <dc:creator>tominal</dc:creator>
      <dc:date>2022-02-16T09:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with API contacts search using php client library</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/576951#M50928</link>
      <description>&lt;P&gt;Also, I just noticed this. You are going to need to re-roll your API key since you leaked it in your original post.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 03:10:16 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/576951#M50928</guid>
      <dc:creator>tominal</dc:creator>
      <dc:date>2022-02-16T03:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with API contacts search using php client library</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/577217#M50936</link>
      <description>&lt;P&gt;Thank you for this.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 12:43:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/577217#M50936</guid>
      <dc:creator>JNichel</dc:creator>
      <dc:date>2022-02-16T12:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with API contacts search using php client library</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/577221#M50937</link>
      <description>&lt;P&gt;It did help.&amp;nbsp; Thank you.&amp;nbsp; I haven't seriously written any code in a lot of years and even though the example didn't look right to me, I thought it had to be correct because it was in the SDK documentation.&amp;nbsp; Like maybe it was shorthand for creating arrays.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 12:52:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/577221#M50937</guid>
      <dc:creator>JNichel</dc:creator>
      <dc:date>2022-02-16T12:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with API contacts search using php client library</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/577377#M50945</link>
      <description>&lt;P&gt;That's awesome to hear! Also, I am so used to defining arrays that way I did not even think to mention that it is a shorthand for creating arrays as well.&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;$var = [];&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;is the same as&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;$var = array();&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope you have more luck than I did with the SDK!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 15:49:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Problem-with-API-contacts-search-using-php-client-library/m-p/577377#M50945</guid>
      <dc:creator>tominal</dc:creator>
      <dc:date>2022-02-16T15:49:22Z</dc:date>
    </item>
  </channel>
</rss>

