thank you for reaching out. I wouldn’t call myself an expert, but I have two ideas of what might cause problems.
The first is that it appears that the two values (highValue and value) need to be switched around. The other one is, that the timestamps need to be in a string format according to the docs. I’m not really sure about that one as I looked at my code, and it’s also in integers, but who knows… might do the trick after all.
the issue was that you were missing the filters list element within the filterGroups argument. So, in total, your code should look something like this:
import os
from pprint import pprint
from hubspot import HubSpot
from hubspot.crm.deals import PublicObjectSearchRequest, ApiException
api_client = HubSpot(access_token=os.getenv("access_token"))
properties = ["name"] # Don't forget your properties
public_object_search_request = PublicObjectSearchRequest(
filter_groups=[
{
"filters": [
{
"propertyName": "hs_lastmodifieddate",
"operator": "BETWEEN",
"highValue": 1670461200000,
"value": 1670454000000,
}
]
}
],
sorts=[{"propertyName": "hs_object_id", "direction": "ASCENDING"}],
properties=properties,
)
try:
api_response = api_client.crm.deals.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)
If you found this post helpful, consider helping others in the community to find answers faster by marking this as a solution. I’d really appreciate it.