Error Acknowledging Incident via API

Hi,

I am trying to acknowledge an Incident via the API, but am getting the following error using both ServiceNow and Postman:
“error”: {
“message”: “Invalid Input Provided”,
“code”: 2001,
“errors”: [
“Incidents must be a Array.”
]
}

As per the dosc, the id field should be a string as far as I can see which is what I am posting, my URL looks like this:

https://api.pagerduty.com/incidents?id=UNIQUE_ID_HERE

This works fine using the ‘Try It’ feature on the API Reference page, but as mentioned both ServiceNow and Postman produce the same error.

Any help would be appreciated!

Thanks

Jason

Should be something like this:

curl --request PUT
–url https://api.pagerduty.com/incidents/P12345
–header ‘accept: application/vnd.pagerduty+json;version=2’
–header ‘authorization: Token token=FOO’
–header ‘content-type: application/json’
–header ‘from: FOO@EXAMPLE.COM
–data ‘{“incident”:{“type”:“incident”,“status”:“acknowledged”}}’

1 Like

Thanks for the response Doug!

Hard-coding the id at the end of the URL seems to work, however, I need to pass it as a parameter.

When I add it as a query parameter in Postman for example, my URL is appended with /?id=P12345 as opposed to just /P12345.

Is there a way to pass the Incident ID to the call as a parameter?

Many Thanks,

Jason

Hey Jason,

Can you share the call you are making it might help out here to clarify this. Remember as its the community page please redact any sensitive information.

Kind regards,
John

1 Like

Hi John,

Sure, this is the code snippet generated from Postman which produces the error referenced in the original post:

curl --location --request PUT ‘https://api.pagerduty.com/incidents/?id=P123456
–header ‘From: test@test.com
–header ‘Content-Type: application/json’
–header ‘Accept: application/vnd.pagerduty+json;version=2’
–header ‘Authorization: Token token=******’
–data-raw ‘{
“incident”: {
“type”: “incident_reference”,
“status”: “acknowledged”
}
}’

As you can see, when using a query parameter, the request is appended with ‘?/id=P123456’ and this seems to be what is causing the error as when i try it as Doug suggested, it works fine.

Let me know if you need any more info?

Much Appreciated,

Jason

@jodonnell/@dmcclure, thank you both for your input!
Just to let you know, I have managed to find a solution within ServiceNow which allows me to build the URL with a parameter without using query parameters - problem solved!

Many Thanks,

Jason