APIs & Integrations

pmaxodoo
Teilnehmer/-in

Error of Search Contact API when response over 10,000 contacts

lösung

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!!!!

0 Upvotes
1 Akzeptierte Lösung
dennisedson
Lösung
HubSpot-Produktteam
HubSpot-Produktteam

Error of Search Contact API when response over 10,000 contacts

lösung

@pmaxodoo ,

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.

Lösung in ursprünglichem Beitrag anzeigen

3 Antworten
dennisedson
Lösung
HubSpot-Produktteam
HubSpot-Produktteam

Error of Search Contact API when response over 10,000 contacts

lösung

@pmaxodoo ,

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.

pmaxodoo
Teilnehmer/-in

Error of Search Contact API when response over 10,000 contacts

lösung

Thanks, @dennisedson. My fault for not reading all the docs carefully.

0 Upvotes
dennisedson
HubSpot-Produktteam
HubSpot-Produktteam

Error of Search Contact API when response over 10,000 contacts

lösung

No worries!  Hope you can refactor your code accordingly!

0 Upvotes