KimS
September 25, 2023, 10:55am
1
Hello,
I need to query contacts that have a specific custom field filled. How can I do this?
I found this in the documentation ( Accounts Dashboard | HubSpot ) but it’s not clear what each field is for
curl --request POST \
--url 'https://api.hubapi.com/crm/v3/objects/contacts/batch/read?archived=false' \
--header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'content-type: application/json' \
--data '{
"properties": [
"string"
],
"propertiesWithHistory": [
"string"
],
"idProperty": "string",
"inputs": [
{
"id": "string"
}
]
}'
Thank you
bohart
September 25, 2023, 12:48pm
2
Hi @KimS ,
You can use `/crm/v3/objects/contact/search` endpoint instead (to search contacts by any of their properties). It should be more understandable. Here is a callback example:
curl 'https://api.hubapi.com/crm/v3/objects/contact/search' \
-H 'authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'content-type: application/json' \
--data '{
"filterGroups": [
{
"filters": [
{
"propertyName": "PROPERTY_NAME_TO_FILTER/SEARCH",
"operator": "EQ",
"value": "YOUR_VALUE_TO_SEARCH_IN_THE_PROPERTY"
}
]
}
],
"properties": [
"property_name1_to_include_in_the_results_for_all_found_contacts",
"property_name2_to_include_in_the_results_for_all_found_contacts"
],
"limit": 10
}'
KimS
September 25, 2023, 12:57pm
3
Thank you very much, works like a charm.
KimS
September 25, 2023, 2:24pm
4
Actually, what about paging there?
I did a test with limit = 1 (had only 2 items with said field)
And it returns
“paging”:{“next”:{“after”:“1”}}}
what is the next call to make for next page then?