Merging same incident in one incident automatically

rest-api
(Harsh Maru) #1

Hallo, As i am new in pager-duty, I am creating a incident using Event API V2 using JavaScript.

my code :

const fetch = require(‘node-fetch’)
const main = async () => {
const Incident = (await (await fetch(’/incidents’, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
‘Accept’: 'application/vnd.pagerduty+json;version=2 ',
‘From’: ‘blabla.com’,
‘Authorization’: ‘Token token=H6eo’
},
body: JSON.stringify({
“incident”: {
“type”: “incident”,
“title”: “The server is on fire 500.”,
“service”: {
“id”: “PZF3”,
“type”: “service_reference”
},
“escalation_policy”: {
“id”: “PQ4”,
“type”: “escalation_policy_reference”
},
“incident_key”: “1”,
“body”: {
“type”: “incident_body”,
“details”: "A disk is getting full on this machine. "
},
}
})
})).json())

console.log(Incident)

}
main().catch(err => console.log(err))

The incident is create first time successfully. if the incident is coming same as like above second time, it show an error.

error second time:

Same error if I provide “dedup_key”: “1” in body.

{ error:
{ message: ‘Arguments Caused Error’,
code: 2002,
errors:
[ ‘Open incident with matching dedup key already exists on this service’ ] } }

As i ask support, they provide me an documentation of event Management //support.pagerduty.com/docs/event-management, where its mention using same incident key, we can merge same incident in one automatically. but it haven’t worked out for me !

Please let me know, where I am wrong!

Best Regards
Harsh

(John O'Donnell) #2

Hi Harsh,

Thanks for reaching out on Community. Since we already have an open Support ticket on this one and as it contains some sensitive info, I will keep the thread going there!

Kind regards,
John

(system) closed #3

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.