Incidents total is not correct

rest-api
incidents
bug

(Drew Buckman) #1

When I make a request to https://api.pagerduty.com/incidents using version 2 api until yesterday it gave me the total number of incidents for that query. I could use that number to paginate through the list. Now if I set a limit=1 it tells me the total is 2. If I set limit=100 it tells me the total is 101.

Did something change?


(Isaac Johnston) #2

It seems like something wonky happened with the offset parameter around the same time. For example, when I make a request to get all of our incidents created since August 1 with a limit of 100, I get 57 incidents. When I change the limit to 25 and set the offset to 25, I only get 1 incident. I would expect incidents 26-50.

Here’s an example of what I’m seeing with the requests library in Python:

>>> response = requests.get(
        'https://api.pagerduty.com/incidents',
        headers=headers,
        params={'since': '2017-08-01', 'limit': 100}
)
>>> len(response.json()['incidents'])
57
>>> response = requests.get(
        'https://api.pagerduty.com/incidents',
        headers=headers,
        params={'since': '2017-08-01', 'offset': 25, 'limit': 25}
)
>>> len(response.json()['incidents'])
1

Thanks


(Oscar Linares) #3

As it turns out you ran into a bug that has now been resolved. You should see the expected behavior going forward.

We apologize for any inconvenience this may have caused. If you are still seeing the incorrect behavior, please don’t hesitate to let us know.


(Drew Buckman) #4

Well it was fixed, but now the bug is back. Having the same issue again.


(Sean Higgins) #5

Hi Drew -

We’ve been working on improvements to the queries and API response time and just rolled additional changes this morning. We’re checking into this issue right now.

Sean


(Sean Higgins) #6

Hi Drew, Isaac -

The totals should now be reporting correct counts.

Let me know if you run into any other issues!

Sean


(system) #7