'PagerDuty Pagination

My company uses Power BI and we are trying to get incidents data from PagerDuty API.

I have been struggling to find a way to get all the data but I am unknowledgeable about PowerBI, PowerQuery or dealing with API. I am in database role.

I used Get Data option in Power BI and selected Web as data source. Entered My API link, and passed the headers. The result I get is limited to 25 by default, I can change it to up to 100 but my main issue is with not being able to get next set of results.

I need to have some kind of loop to increase the offset parameter and refeth the query.

My current query in PowerBI looks like this.

= Json.Document(Web.Contents("https://api.pagerduty.com/incidents", [Headers=[Accept="application/vnd.pagerduty+json;version=2", #"Content-Type"="application/json", Authorization="Token token=MY API KEY"]]))

And it returns me this: enter image description here

I can expand the list and get the data I need. but I only see 25 right now.



Solution 1:[1]

You'll need a way to keep updating an offset parameter in the URL -- for example if you've set limit 25, you'd set offset to 25 to get the next page, 50 to get the next page after that, and so on, like so:

https://api.pagerduty.com/incidents?offset=25

I'm not sure how you'd accomplish that in your tool, though! Here's a link to the PagerDuty documentation on pagination in case you need extra details.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hannele