Get Device Status Example

The following code example gets the status of all devices in your EMnify account.


function getDeviceStatus(){
    fetch(`https://cdn.emnify.net/api/v1/endpoint`, {
        method: 'GET',
        headers: {
            "accept": "application/json",
            "Authorization": `Bearer ${token}` // Authentication token
        }
        })
        .then(result => result.json())
        .then(result => {
        console.log(result)
        })
}

The result will look something like this.

[
    {
        id: 11180765,
        name: 'Test_device231', // Device Name
        tags: 'dashboard',
        created: '2021-06-24T19:02:43.000+0000',
        last_updated: '2021-06-24T19:02:49.000+0000',
        status: { id: 0, description: 'Enabled' },
        service_profile: { id: 421239, name: 'Generic Service Profile' },
        tariff_profile: { id: 409292, name: 'Generic Tariff Profile' },
        sim: {
        id: 3991447,
        iccid: '898830300000***9680',
        imsi: '2950509****1169',
        msisdn: '423**39212***74'
        },
        imei: **********,
        ip_address: '100.**.*.***',
        ip_address_space: { id: 6808 },
        imei_lock: false
    }
]