APIs & Integrations

MFall13
Colaborador(a) | Parceiro Platinum
Colaborador(a) | Parceiro Platinum

POST /crm/v3/objects/{objectType}/search no filters for CONTAINS or ICONTAINS

resolver
It doesn't appear that /crm/v3/objects/{objectType}/search  allows for "icontains" or "contains" which would be super helpful for searching for a substring within a text property type. Am I missing something here, or is this a known limitation?
0 Avaliação positiva
1 Solução aceita
webdew
Solução
Orientador(a) | Parceiro Diamante
Orientador(a) | Parceiro Diamante

POST /crm/v3/objects/{objectType}/search no filters for CONTAINS or ICONTAINS

resolver

Hi @MFall13 ,

Please use this documentation :
https://developers.hubspot.com/docs/api/crm/search

This is not "icontains" or "contains" allowed in search api.

please check this for search https://prnt.sc/1r0rfry and use below code

<?php
$data = '{
"filters": [
{
"propertyName": "<propertyName>",
"operator": "CONTAINS_TOKEN",
"value": "test"
}
]
}';
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.hubapi.com/crm/v3/objects/{objectType}/search?hapikey=YOUR_HUBSPOT_API_KEY');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);

Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards. 

Exibir solução no post original

2 Respostas 2
webdew
Solução
Orientador(a) | Parceiro Diamante
Orientador(a) | Parceiro Diamante

POST /crm/v3/objects/{objectType}/search no filters for CONTAINS or ICONTAINS

resolver

Hi @MFall13 ,

Please use this documentation :
https://developers.hubspot.com/docs/api/crm/search

This is not "icontains" or "contains" allowed in search api.

please check this for search https://prnt.sc/1r0rfry and use below code

<?php
$data = '{
"filters": [
{
"propertyName": "<propertyName>",
"operator": "CONTAINS_TOKEN",
"value": "test"
}
]
}';
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.hubapi.com/crm/v3/objects/{objectType}/search?hapikey=YOUR_HUBSPOT_API_KEY');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);

Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards. 

MFall13
Colaborador(a) | Parceiro Platinum
Colaborador(a) | Parceiro Platinum

POST /crm/v3/objects/{objectType}/search no filters for CONTAINS or ICONTAINS

resolver

I actually found that using wildcards * in front and trailing the string works just fine for my use case: 

"filters": [
{
"propertyName": "<propertyName>",
"operator": "CONTAINS_TOKEN",
"value": "*test*"
}
]

 Thanks!