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).
Jul 10, 2021 5:35 PM
Hi,
I'm trying to search for contacts that do not have an owner.
I'm using python and here's how my request looks like
headers = {"content-type":"application/json"}
filters = {"filterGroups": [{"filters": [{"propertyName": "hubspot_owner_id","operator": "NOT_HAS_PROPERTY"}],}],"limit":100}
paramso = {'hapikey': HUB_SPOT_API_KEY}
response = requests.post(cls.search_end_point,params=paramso,json=filters,headers=headers)
where
search_end_point = 'https://api.hubapi.com/crm/v3/objects/deals/search'
The problem is, in the Response's JSON: I'm getting a total of 250 which brings the need to paginate.
And when I do response.json().get("paging"), here's what I get:
{'next': {'after': '100'}}
Isn't that weird ?
Jul 11, 2021 3:02 PM - edited Jul 11, 2021 3:12 PM
Hey @shtlrs
When you say not working properly what do you mean?
Disclaimer: I'm not familiar with PHP, I'm using postman and am relatively new to the API.
I believe you'd have to make additional calls after your limit. I could be off base here but I believe the "next…after" is just letting you know that you next call should define "after" as 100 or above.
Your next call might look like:
filters = {"filterGroups": [{"filters": [{"propertyName": "hubspot_owner_id","operator": "NOT_HAS_PROPERTY"}],}],"limit":100,"after":100}
Edit:
I like to sort the response jut so i know im getting the objects in an order I define.
Another thing, which you probably know: You can probably build you limits by dividing the total by the limit, thus giving you your number of pages.