Hello Team,
I am working on CRM search API. I am trying to search the companies that having domain name equals to a value and return their company id, company name and state. Here’s my code:
import hubspot
from pprint import pprint
from hubspot.crm.contacts import PublicObjectSearchRequest, ApiException
client = hubspot.Client.create(access_token="My API Key")
filter_groups = [{"filters":[{
"value":"Domain Name Value",
"propertyName":"domain",
"operator":"EQ"}]}]
public_object_search_request = PublicObjectSearchRequest(filter_groups=filter_groups,
properties=["hs_object_id","name","state","domain"],
limit=0, after=0)
try:
api_response = client.crm.companies.search_api.do_search(public_object_search_request=public_object_search_request)
pprint(api_response)
except ApiException as e:
print("Exception when calling search_api->do_search: %s\n" % e)
And the return is like:
![]()
I have verified that the ‘total: 76’ is exactly the number of companies meeting the requirement. So I guess the search api is working. The only problem is that it doesn’t return the properties I wanted. What should I do to the properties?
Thanks