Partial Search

New Contributor

Is there any way we can search for a property partially? 

like the content like '%SAM%'?

Reply
0 Upvotes
4 Replies 4
Highlighted
HubSpot Moderator

Hey @amitc005 ,

 

You should be able to use the new CRM Search API for this purpose: https://developers.hubspot.com/docs/api/crm/search

Reply
0 Upvotes
Highlighted
New Contributor

I checked and current we have query which searches some properties of the object, for eg, for tickets 

"hs_ticket_category",

"hs_ticket_id",

"subject",

"hs_pipeline_stage",

"content"

But I want something search for a particular property. 

Reply
0 Upvotes
Highlighted
HubSpot Moderator

Hey @amitc005 ,

 

The default searchable properties you're describing is the set of properties we look at for query searches. For example, if you made the following request:

 

curl https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey=YOUR_HUBSPOT_API_KEY \
  --request POST \
  --header "Content-Type: application/json" \
  --data '{
    "query": "x"
  }'

HubSpot would return contact records where x appeared in any of the default searchable properties for contacts (i.e. firstname, hs_additional_emails, phone, hs_object_id, hs_searchable_calculated_phone_number, company, email, lastname). 

 

But any property is searchable using Filters, described in the section right above Search. If you wanted to get all contact records where exampleCustomProperty contains test, you could 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": "exampleCustomProperty",
            "operator": "CONTAINS_TOKEN",
            "value": "test"
          }
        ]
      }
    ]
  }'

 

Reply
0 Upvotes
Highlighted
New Contributor

V3 CRM search api is not woking, for example if contact property firstname have value "Hemal" and if i try to search with "hem", API is not giving any results.

Reply
0 Upvotes