Edits history of script submission #24133 for ' List revisions (tufin_securetrack)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * List revisions
     * List the policy revisions SecureTrack recorded for a device. Get the device ID from List devices.
     */
    export async function main(auth: RT.TufinSecuretrack, device_id: number) {
      const base = auth.base_url.replace(/\/+$/, "")
      const url = new URL(`${base}/securetrack/api/devices/${device_id}/revisions`)
    
      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