List the policy revisions SecureTrack recorded for a device.
1
//native
2
3
/**
4
* List revisions
5
* List the policy revisions SecureTrack recorded for a device. Get the device ID from List devices.
6
*/
7
export async function main(auth: RT.TufinSecuretrack, device_id: number) {
8
const base = auth.base_url.replace(/\/+$/, "")
9
const url = new URL(`${base}/securetrack/api/devices/${device_id}/revisions`)
10
11
const response = await fetch(url, {
12
method: "GET",
13
headers: {
14
Authorization: `Basic ${btoa(`${auth.username}:${auth.password}`)}`,
15
Accept: "application/json",
16
},
17
})
18
19
if (!response.ok) {
20
throw new Error(`${response.status} ${await response.text()}`)
21
}
22
23
return await response.json()
24
25