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).
Apr 5, 2022 5:18 AM - edited Apr 5, 2022 5:33 AM
Hi all,
I met this error and i dont know why. I search the lastmodified contact after a timestamp:
public_object_search_request = PublicObjectSearchRequest(filter_groups=[{"filters":[{"value":"1649130562421",
"propertyName":"lastmodifieddate",
"operator":"GTE"}]}],
sorts=["DESCENDING"],
properties=["id"],
limit=100,
after=9900)
try:
api_response = client.crm.contacts.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)
Resonpse:
"total": 10010,
"results": []
"paging": {
"next": {
"after": "10000"
}
}
After this response, I call this request:
public_object_search_request = PublicObjectSearchRequest(filter_groups=[{"filters":[{"value":"1649130562421",
"propertyName":"lastmodifieddate",
"operator":"GTE"}]}],
sorts=["DESCENDING"],
properties=["id"],
limit=100,
after=10000)
try:
api_response = client.crm.contacts.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)
Then I got this response:
HTTP 400
{
"status": "error",
"message": "There was a problem with the request.",
"correlationId": "2e7a35b9-dc8b-4cb5-8db8-4a573efe7cfc"
}
What am I doing wrong here?
Thank you so much!!!!
Solved! Go to Solution.
Apr 5, 2022 1:14 PM
If you look in the docs, there is actually a limit of the Search API with results over 10k. When you hit that limit, you can expect a 400 error.
Apr 5, 2022 1:14 PM
Apr 5, 2022 10:29 PM
Thanks, @dennisedson. My fault for not reading all the docs carefully.
Apr 5, 2022 10:37 PM
No worries! Hope you can refactor your code accordingly!