APIs & Integrations

pmaxodoo
Participante

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

resolver

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 Avaliação positiva
1 Solução aceita
dennisedson
Solução
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

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

resolver

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

Exibir solução no post original

3 Respostas 3
dennisedson
Solução
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

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

resolver

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

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

resolver

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

0 Avaliação positiva
dennisedson
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

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

resolver

No worries!  Hope you can refactor your code accordingly!

0 Avaliação positiva