Get a count of total records retrieved by the filter_tickets Method
As a developer I would like to know the total count of tickets returned by a query_string so that I know if I cannot retrieve all the tickets in the query.
Hi Sam I really like this project and hope to use it quite a bit. But sadly you are shielding this fairly critical indicator in your implementation of filter_tickets.
My preferred implementation would be to simply have a method called total_records(self, query, **kwargs) which retrieve only one page but would get the total of records.
I'd be happy to fork and contribute this if you would like me to.
Hi, filter_tickets() will iterate over all pages and return a list of all Ticket instances. Do you have a use-case where you cannot call that to fetch all and len() the result? (efficiency maybe?)
I have just noticed we can only return the first 10 pages of tickets with the API. Is this the limitation you're running up against?
Yes, the API is limited to 10 pages with at most 30 records, so 300 in total. However the total field shows the total number.
I'd love to use your library, but would want to run a request first, see if there are more than 300 records and then split this request in to several requests with on of several dimension values. Ie. query by priority, date, status, assigned user, ...
If I make a request for each possible permutation I hit several thousand requests and this would run for nearly an hour (and until I get rate limited/or even blacklisted). So I want to check the record count for a less restrictive query first and only create the more restrictive one if I'm exceeding the limit of 300 tickets.
Ok, that makes sense. You're welcome to fork if you want, however I've got an idea that would both implement what you are needing easily while maintaining backwards compatibility with the existing filter.
I'll report back soon.
I'll check this on my tomorrow and can then fork or leave it to you. Thanks for this great library and support.
Maybe to comment on one point here though, your query paginates automatically and that's triggering many requests which may not be needed (because the result can be incomplete) it would be useful if we can turn pagination off and get only a single record when retrieving the total number of records.
Maybe to comment on one point here though, your query paginates automatically and that's triggering many requests which may not be needed (because the result can be incomplete) it would be useful if we can turn pagination off and get only a single record when retrieving the total number of records.
I agree, that was part of what I was thinking. Good catch!
Apologies - I have been flat out and haven't had a chance yet :smile: