Can you update the title of an Incident using v2 API in a PowerShell Script

rest-api
howto
incidents

(Eric) #1

I am trying to create a PowerShell script as part of an SCOM, SCSM, and Pagerduty automated solution. I would like to update the Incident title in Pagerduty to include the Service Manager Incident ID once it has been created. Is this possible. I can get the Incident using the Invoke-restmethod -method Get, but I have not been successful in figuring out if I can update the title using the Put method.


(Jay Chiarella) #2

Hi Eric,

You can update the title of an existing incident using the /incidents/{id} endpoint with a PUT API request. You’ll want to include a title field with a new value in the body of your API request. You can read further about this endpoint in our developer documentation.

Below is a simple example of changing an incident title using a cURL command:

curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'From: [REDACTED]' --header 'Authorization: Token token=[REDACTED-REST-API-KEY]' -d '{"incident": {
	"type":"incident",
        "title": "Changed Title"
	}
}' 'https://api.pagerduty.com/incidents/<ENTER-YOUR-INCIDENT-ID-HERE>'

Cheers,

Jay


(system) #3