How to send array to the incident api?

Hi All,

I am trying to make a get request to ‘https://api.pagerduty.com/incidents’ following instruction on https://developer.pagerduty.com/api-reference/reference/REST/openapiv3.json/paths/~1incidents/get .
I would like to make a request with ‘statuses’ parameter to get only those incidents that fall under '“triggered” or “acknowledged” category.

My url looks like -
url = “https://api.pagerduty.com/incidents?statuses[]=acknowledged,triggered

which returns error
{‘error’: {‘message’: ‘Invalid Input Provided’, ‘code’: 2001, ‘errors’: [‘Statuses must be in triggered, acknowledged, or resolved.’]}}

What is the correct way to make a call?

Thank you.

Hi Vivek,

Thanks for reaching out!

You’ll want to specify the status in separate fields, which will look like this on Postman:

The equivalent cURL would be this:

curl --location -g --request GET ‘https://api.pagerduty.com/incidents?total=false&date_range=all&time_zone=UTC&statuses[]=resolved&statuses[]=acknowledged
–header ‘Authorization: Token token=redacted’
–header ‘Accept: application/vnd.pagerduty+json;version=2’
–header ‘Content-Type: application/json’

Please let us know if this is helpful or have additional questions.

Regards,

Alex Engelmann
Technical Support Specialist
PagerDuty.com

1 Like

Hi Vivek,

Your query looks correct, how many incidents were you expecting to see? The maximum limit is 100 at a time (with more requiring the use of pagination), so 5 should be no problem. Since this is a community ticket in a public forum, feel free to write in to support@pagerduty.com and we can take a closer look in your account and maybe set up a screenshare to get to the bottom of this.

Please let me know.

Regards,

Alex Engelmann
Technical Support Specialist
PagerDuty.com