//native
/**
* Get ticket
* Get a SecureChange ticket by ID, with its workflow, steps, tasks and field values.
*/
export async function main(auth: RT.TufinSecurechange, ticket_id: number) {
const base = auth.base_url.replace(/\/+$/, "")
const url = new URL(
`${base}/securechangeworkflow/api/securechange/tickets/${ticket_id}`
)
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: `Basic ${btoa(`${auth.username}:${auth.password}`)}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 6 hours ago