need to setup token with
export token=
--header 'From: weldpua2008@com'
while [[ $(echo ${j}|jq ."incidents") != "[]" ]];do
j=$( echo -n '{"incidents":'; curl -X GET --header 'Accept: application/vnd.pagerduty+json;version=2' --header "Authorization: Token token=${token}" 'https://api.pagerduty.com/incidents?statuses%5B%5D=triggered&time_zone=UTC&sort_by=created_at' | jq -c '.incidents|.[]|{ id: ."id", "type": "incident_reference", "status": "resolved"} '| jq --slurp '.';echo -n '}' )
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'From: weldpua2008@com' --header "Authorization: Token token=${token}" -d "$j" "https://api.pagerduty.com/incidents"
sleep 1
done
Example Json
{"incidents":[
{
"id": "PEE92YQ",
"type": "incident_reference",
"status": "resolved"
}
]}
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'From: weldpua2008@com' --header "Authorization: Token token=${token}" -d '{"incidents":[
{
"id": "PEE92YQ",
"type": "incident_reference",
"status": "resolved"
}
]}' "https://api.pagerduty.com/incidents"