PagerDuty/pdpyras

Pagination doesn't seem to work with `iter_all`

jacklund opened this issue · 2 comments

When I have code like the following:

from pdpyras import APISession

api_token = '<redacted>'
session = APISession(api_token)

for incident in session.iter_all('incidents', params={'service_ids[]': ['<redacted>'], 'since': '2020-08-01T00:00:00Z'}):
    print("{id}\t{created_at}\t{html_url}\t{description}\t{resolve_reason}".format(**incident))

I only get around 25 incidents. If I change the since date, I get a different 25-ish incidents, so it seems like the pagination isn't working. (Also, I know from the PD website that there are definitely much more than 25 incidents for this query).

Any ideas?

Thanks.

Have this same issue - attempting to bulk update incidents using this library with no luck getting pagination to work properly. My result set is limited the same way.

Hi @jacklund and @blardo,

In the incidents API, if one does not specify both ends of a date range, it will default to one month that begins at since or ends at until. In this example here it would only return incidents in the range 2020-08-01 thru 2020-09-01.

I have submitted an internal issue ticket to document this behavior in the appropriate place.

For all questions specifically pertaining to the API, Customer Support and the PagerDuty forums are the best places to get help.