Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deals - dealing with offset #139

Open
cklm opened this issue Jun 13, 2022 · 0 comments
Open

deals - dealing with offset #139

cklm opened this issue Jun 13, 2022 · 0 comments

Comments

@cklm
Copy link

cklm commented Jun 13, 2022

We want to get all closed deals from the api, so we are fetching /ver1/deals?limit=1000&offset=0&order_direction=asc&scope=finished&order=closed_at.
We are incrementing the offset as long as there are deals coming back (0, 1000, 2000, 3000, ...). To avoid fetching the same deals again and again (reduce number of api-calls, resources), we save the last offset. So the next day our call might be /ver1/deals?limit=1000&offset=5000&order_direction=asc&scope=finished&order=closed_at. This works as long as the number of deals is not reduced (then we got no deals back, even if there were newer deals), which happens sometimes. We guess, that for example removing an account removes all corresponding deals. In that case, we manually need to find the problem why there are no new deals coming back, reset the offset back to 0 and fetch all deals again.
The only way we see to avoid that completly is to always fetch all deals (which leads to more api-calls and more database-traffic).
Do you see any solution for that problem with the current api?

The best option resource-wise would be the following:
Adding a new parameter to /ver1/deals, similar to the from-option, but for the closed_at-field. Then we could save the date of the newest deal and take that for the next fetch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant