We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Sep 1, 2021 5:21 PM
/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?Solved! Go to Solution.
Sep 2, 2021 9:15 AM
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.
Sep 2, 2021 9:15 AM
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.
Sep 10, 2021 9:37 AM
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!