0

Apply URL list changes

Published 20 days ago

Deploy all pending URL list changes on the tenant so policies use them.

Script netskope Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 21 days ago
1
//native
2

3
/**
4
 * Apply URL list changes
5
 * Deploy all pending URL list changes on the tenant so policies use them.
6
 */
7
export async function main(auth: RT.Netskope) {
8
  const url = new URL(
9
    `${auth.tenant_url.replace(/\/+$/, "")}/api/v2/policy/urllist/deploy`
10
  )
11

12
  const response = await fetch(url, {
13
    method: "POST",
14
    headers: {
15
      "Netskope-Api-Token": auth.token,
16
      Accept: "application/json",
17
    },
18
  })
19

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

24
  const text = await response.text()
25
  return text ? JSON.parse(text) : { success: true }
26
}
27