APIs & Integrations

nstansby
Participant

Query field in v3 search API

SOLVE

I am trying to use the v3 search API (/crm/v3/objects/contacts/search).  I've been struggling to understand the query field... I haven't been able to find any documentation on it, or examples.  It seems the combination of the properties and filterGroups fields in the request specifiy what records you want, and what properties you want to retrieve, so what is the purpose of the query field?  And can anyone point me at an example of how to use it?

 

I'm new to HubSpot and decided to dive directly into the v3 API; maybe this is a concept carried over from earlier versions of the API?

0 Upvotes
1 Accepted solution
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Query field in v3 search API

SOLVE

Hey @nstansby,

 

Welcome to HubSpot 🙂 

 

The query will search based on the default searchable properties (mentioned on this documentation: CRM API | Search) i.e. for contacts, it would be firstname, hs_additional_emails, phone, hs_object_id, hs_searchable_calculated_phone_number, company, email and lastname. 

View solution in original post

7 Replies 7
WendyGoh
HubSpot Employee
HubSpot Employee

Query field in v3 search API

SOLVE

Hey @kawyns1,

 

This is possible via the HubSpot CRM API | Search. You can do something like this:

 

 

curl https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=YOUR_HUBSPOT_API_KEY \
  --request POST \
  --header "Content-Type: application/json" \
  --data '{
    "filterGroups":[
      {
        "filters":[
          {
            "propertyName": "lastmodifieddate",
            "operator": "EQ",
            "value": "{{timestamp here}}"
          }
        ]
      }
    ]
  }

 

 

BEAutoBot
Participant

Query field in v3 search API

SOLVE

This is the correct answer and contains the important structure of the neccessary query object. Thank you.

Long_Nguyen
Contributor

Query field in v3 search API

SOLVE

Hi  @WendyGoh 

Is this API available via URL in the browser? Can you please give me an example of URL rather than curl?

For example, with API version 1, in order to list all contacts with specific properties I can paste in the browser with the following URL.

https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=YOUR_HUBSPOT_API_KEY&count=15&&pro...Snipaste_2021-11-26_15-40-59.png

0 Upvotes
Spark-Y
Member

Query field in v3 search API

SOLVE

Can anyone give some examples for the PHP in curl ?

0 Upvotes
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Query field in v3 search API

SOLVE

Hey @nstansby,

 

Welcome to HubSpot 🙂 

 

The query will search based on the default searchable properties (mentioned on this documentation: CRM API | Search) i.e. for contacts, it would be firstname, hs_additional_emails, phone, hs_object_id, hs_searchable_calculated_phone_number, company, email and lastname. 

kawyns1
Participant

Query field in v3 search API

SOLVE

Hi @WendyGoh ,

I have a similar use case where i want to filter by the lastmodifieddate property to get the tickets records since the last timestamp. Is it possible to get this data from the search crm api?

0 Upvotes
nstansby
Participant

Query field in v3 search API

SOLVE

Thanks @WendyGoh , I'd just been looking at the endpoint documentation.  The link you sent is exactly what I needed.

0 Upvotes