//native
/**
* Get Incident
* Retrieve a single incident by its ID. Use List Incidents to find IDs.
*/
export async function main(auth: RT.Pagerduty, incident_id: string) {
const url = new URL(`https://api.pagerduty.com/incidents/${incident_id}`)
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: `Token token=${auth.token}`,
Accept: "application/vnd.pagerduty+json;version=2",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 days ago