Edits history of script submission #24093 for ' Apply URL list changes (netskope)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Apply URL list changes
     * Deploy all pending URL list changes on the tenant so policies use them.
     */
    export async function main(auth: RT.Netskope) {
      const url = new URL(
        `${auth.tenant_url.replace(/\/+$/, "")}/api/v2/policy/urllist/deploy`
      )
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Netskope-Api-Token": auth.token,
          Accept: "application/json",
        },
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      const text = await response.text()
      return text ? JSON.parse(text) : { success: true }
    }
    

    Submitted by hugo989 6 hours ago