0

Get named list

by
Published today

Get a Threat Defense named list by ID, including its items and assigned security policies.

Script infoblox_csp Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 6 hours ago
1
//native
2

3
/**
4
 * Get named list
5
 * Get a Threat Defense named list by ID, including its items (items and items_described) and the security policies it is assigned to.
6
 */
7
export async function main(auth: RT.InfobloxCsp, id: number) {
8
  const url = new URL(
9
    `${(auth.base_url || "https://csp.infoblox.com").replace(/\/+$/, "")}/api/atcfw/v1/named_lists/${id}`
10
  )
11

12
  const response = await fetch(url, {
13
    method: "GET",
14
    headers: {
15
      Authorization: `Token ${auth.api_key}`,
16
      Accept: "application/json",
17
    },
18
  })
19

20
  if (!response.ok) {
21
    throw new Error(`${response.status} ${await response.text()}`)
22
  }
23

24
  return await response.json()
25
}
26