//native
/**
* Get URL list
* Get one URL list by ID: name, data.urls, data.type and the pending flag.
*/
export async function main(
auth: RT.Netskope,
url_list_id: number,
field: string | undefined
) {
const url = new URL(
`${auth.tenant_url.replace(/\/+$/, "")}/api/v2/policy/urllist/${url_list_id}`
)
if (field != null && field !== "") {
url.searchParams.append("field", field)
}
const response = await fetch(url, {
method: "GET",
headers: {
"Netskope-Api-Token": auth.token,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 7 hours ago