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

@Inactive-Member-27144877/@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