need help to export to csv from powershell

I have powershell query to export incidents which are raised, but here i am getting only 25 records. I needed 3 help here.

  1. Needed all data
  2. how to export it in CSV format
  3. can i schedule this report on monthly basis…
    When i fetch data i am getting all these feilds, and the same has to come in csv table…
    id incident_number description service_id service_name escalation_policy_id escalation_policy_name created_on resolved_on seconds_to_first_ack seconds_to_resolve auto_resolved escalation_count auto_escalation_count acknowledge_count assignment_count acknowledged_by_user_ids acknowledged_by_user_names assigned_to_user_ids assigned_to_user_names resolved_by_user_id resolved_by_user_name urgency

$headers=@{}
$headers.Add(“accept”, “application/vnd.pagerduty+json;version=2”)
$headers.Add(“content-type”, “application/json”)
$headers.Add(“authorization”, “Token token=xxxxxxxxxxxxx”)
$response = Invoke-RestMethod -Uri ‘https://api.pagerduty.com/incidents?service_ids[]=xxxxx’ -Method GET -Headers $headers

Hello,

You are facing this limit as many end points will be paginated. You can offset this by 100 though to get more results - check out more on this here.

Kind regards,
John

Here’s an example that may help you get started with getting all of the data for an object in PagerDuty. Then you can add in the CSV exporting. I’d imagine you could use some kind of Windows scheduling capability, cron job, etc. to run this monthly.

https://www.powershellgallery.com/packages/PSPagerDuty/0.0.1/Content/public\Get-PagerDutyData.ps1

Doug

Does PagerDuty have a GraphQL API endpoint?

It would significantly help query selective data fields⁠—especially from include[]'s⁠—without the load of various unnecessary data tagged along with it.

We do not have a GraphQL API endpoint today.

when i ran [Get-PagerDutyData.ps1] i am not getting any output. It’s blank. I updated Powershell Pagerduty package.