List the site's APNs (segments).
1
//native
2
3
/**
4
* List APNs
5
* List the site's APNs (segments) with their IP pool CIDR, VRF, bandwidth limits, priority and DNS settings (v3 API, CPE version 25.50 or later). The API returns all APNs in one response; it has no paging parameters.
6
*/
7
export async function main(auth: RT.EricssonEp5g) {
8
const base = auth.base_url.replace(/\/+$/, "")
9
const url = new URL(
10
`${base}/v3/organization/${encodeURIComponent(auth.organization)}/site/${encodeURIComponent(auth.site)}/nc/apn`
11
)
12
13
const response = await fetch(url, {
14
headers: {
15
"X-Api-Key": auth.api_key,
16
...(auth.user_role ? { "X-User-Role": auth.user_role } : {}),
17
Accept: "application/json",
18
},
19
})
20
21
if (!response.ok) {
22
throw new Error(`${response.status} ${await response.text()}`)
23
}
24
25
return await response.json()
26
27