APIs & Integrations

pmaxodoo
Participant

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

Résolue

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 Votes
1 Solution acceptée
dennisedson
Solution
Équipe de développement de HubSpot
Équipe de développement de HubSpot

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

Résolue

@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.

Voir la solution dans l'envoi d'origine

3 Réponses
dennisedson
Solution
Équipe de développement de HubSpot
Équipe de développement de HubSpot

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

Résolue

@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
Participant

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

Résolue

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

0 Votes
dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

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

Résolue

No worries!  Hope you can refactor your code accordingly!

0 Votes