How do I create a team incident report with a date range through API using the pdpyras library?

Hello PD Community,

I’m 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’ve been working with the pdpyras library in Python and would like to pull out similar data from the following web call:

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 please explain how that would translate to pdpyras query?

Hi Nic.

I’d probably use the session.list_all() method. I don’t have exactly what you’re after, but I had something close in my stash of python junk.

1 Like

Thank you @mandi.walls!

I was uncertain as to how the parameters were set with pdpyras with the additional query details, but this clears things up for me.

I appreciate your response and support.