Skip to main content

Hello PD Community,

I am interested in querying the PD API endpoint to gather incident information by a specific team that I can use to create a bi-weekly report. The report would require the following details through PD’s REST API:

  • Team involved
  • Date Range (UTC)
  • List of ‘high’ incidents within that date range.

I am open to using either HTTP GET requests or pdpyras library.

With pdpyras, I can use pd.list_all(“incidents”) to list a large record of incidents, and then iterate through to search for the corresponding team ID, but this seems highly inefficient and does not account for date ranges.

Ideally, what I would like to pull out of the API endpoint is similar to the data that the following HTTPS endpoint contains:

https://company.pagerduty.com/api/v1/reports/raw/incidents.csv?since=2022-05-01T00%3A00%3A00&until=2023-05-15T23%3A59%3A59&time_zone=Etc%2FUTC&filters[team_ids][]=ABCDEF

Can someone lead me in the right direction as to how it might look through pdpyras or request call in Python 3? I’ve had a look at some of the documentation over the past few days, but haven’t made as much progress as I’d like.

Be the first to reply!