Deals API paginationSOLVE
2 weeks ago - last edited 2 weeks ago
I have created some integration already using the Contacts and Contacts List API.
Now, I have a requirement to work with the Deals API as well. Follow the problem I am facing -
Hubspot API does not allow filters in it's requests. Which means I would need to retrieve ALL contacts in Hubspot (every time I want to update the information on my side) and it's relevant properties, then I can separate information on my side.
For Contacts we can create contacts lists, though. This allows us filtering them using some properties and then fetch the data within this contact list using the contact list API:
Using dates and properties filters to setup a bunch of lists, I don't need to go through all contacts everytime I want to update my side. This worked fantasticly for my last automation.
Now, more information (Deals) are also required and I can't find any workaround for this.
I was hoping have the same ability with the deals, creating pipelines instead of lists, for example, but the API doesn't have the option to "return deals inside a pipeline" endpoint.
Follow what we have -
It doesn't seem to have anything like this:
This is a problem because:
I need to update an excel (weekly internal report) with, for example, the information:
Date Origin Country Leads Sales Revenue
06/06/2019 Website Ireland 10 6 60
Instead of fecthing all contacts and then separating them every week, I found easier to create contact lists where I can set:
Date is after: 01/06/2019
Origin is : Website
Country is: Ireland
And then fetch the contacts in this contacts list, retrieving the property "country". So I can separate it.
When it comes to deals, it doesn't seem to have the same option. The only option I have is to use this:
and paginate it, every week, until it reachs the end. Then do the same again next week. It tends to be undoable overtime.
I was thinking about saving the last pagination and every week the code only runs after the last pagination but:
- I am not sure if my last deals will be always at the end of the entire list (after my last pagination from last week)
- I cannot find the last pagination id before going through this entire list at least once.
Any ideas on how to work around this without need to fetch every week the whole amount of deals within Hubspot?
The limitation of 250 entities for every requisition might become a problem soon if I need to fecth everything every week.
Solved! Go to Solution.