Get one device (IMSI) of the site.
1
//native
2
3
/**
4
* Get device
5
* Get one device (IMSI) of the site: name, status, online flag, segments (APNs), IMEI, ICCID, slices and location.
6
*/
7
export async function main(auth: RT.EricssonEp5g, imsi: string) {
8
const base = auth.base_url.replace(/\/+$/, "")
9
const url = new URL(
10
`${base}/v2/organization/${encodeURIComponent(auth.organization)}/site/${encodeURIComponent(auth.site)}/nc/imsi/${encodeURIComponent(imsi)}`
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