//native
/**
* Get device
* Get one device (IMSI) of the site: name, status, online flag, segments (APNs), IMEI, ICCID, slices and location.
*/
export async function main(auth: RT.EricssonEp5g, imsi: string) {
const base = auth.base_url.replace(/\/+$/, "")
const url = new URL(
`${base}/v2/organization/${encodeURIComponent(auth.organization)}/site/${encodeURIComponent(auth.site)}/nc/imsi/${encodeURIComponent(imsi)}`
)
const response = await fetch(url, {
headers: {
"X-Api-Key": auth.api_key,
...(auth.user_role ? { "X-User-Role": auth.user_role } : {}),
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 6 hours ago