Partial Search

Highlighted
Nuevo colaborador

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

like the content like '%SAM%'?

Responder
0 Me gusta
4 Respuestas 4
Highlighted
Moderador de HubSpot

Hey @amitc005 ,

 

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

Responder
0 Me gusta
Highlighted
Nuevo colaborador

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. 

Responder
0 Me gusta
Highlighted
Moderador de HubSpot

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"
          }
        ]
      }
    ]
  }'

 

Responder
0 Me gusta
Highlighted
Nuevo colaborador

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.

Responder
0 Me gusta