Get a SecureChange ticket by ID.
1
//native
2
3
/**
4
* Get ticket
5
* Get a SecureChange ticket by ID, with its workflow, steps, tasks and field values.
6
*/
7
export async function main(auth: RT.TufinSecurechange, ticket_id: number) {
8
const base = auth.base_url.replace(/\/+$/, "")
9
const url = new URL(
10
`${base}/securechangeworkflow/api/securechange/tickets/${ticket_id}`
11
)
12
13
const response = await fetch(url, {
14
method: "GET",
15
headers: {
16
Authorization: `Basic ${btoa(`${auth.username}:${auth.password}`)}`,
17
Accept: "application/json",
18
},
19
})
20
21
if (!response.ok) {
22
throw new Error(`${response.status} ${await response.text()}`)
23
}
24
25
return await response.json()
26
27