Dashboard API - Viewing clients of a network

ryanpjbyrne
Conversationalist

Dashboard API - Viewing clients of a network

Hi,

 

I'd like to list all clients in a network filtering by SSID similar to how it is done in the dashboard. I can find all clients in the network using a couple of API calls but have been unable to find a way to filter.

 

Can this be done?

4 Replies 4
ryanpjbyrne
Conversationalist

This would be for wireless networks.
HodyCrouch
Building a reputation

I don't think you can do this with the Dashboard API.

 

If you use the Scanning API, you can receive all currently connected wireless devices, including the SSID (if any).

 

Of course, you can't query the Scanning API.  You have to listen continuously.

DexterLaBora
Meraki Employee
Meraki Employee

Unfortunately, there is not an endpoint today to get an array of clients in a network. You must query every device in the network for the clients attached. This is a popular request, so hopefully there will be a better option in the future.

 

I've written a JS script to search for all clients in a network, filtered by model.

 

(work in progress)

JS library: https://github.com/dexterlabora/meraki-service

JS library doc: https://dexterlabora.github.io/meraki-service/module-Custom.html#.getClientsForNetwork

 

Here is a snippet of the function for this operation:

(its not that fast, because the calls are made to be synchronous, to respect the API rate limit of 5/sec)

 

async getClientsForNetwork(netId, timespan, model) {
        if (!netId) {
            return Promise.reject(new Error('The netId is required'))
        }
        if (!timespan) {
            return Promise.reject(new Error('The timespan is required'))
        }
        if (!model) {
            return Promise.reject(new Error('The model type is required: MX, MR, MS'))
        }
        // where model = "MR" MV MX MS MC or model name "MR33"
        let devices = [] = await this.getDevices(netId).then((res) => res);
        let clients = [];
        for (let d of devices) {
            if (model) {
                if (!d.model.includes(model)) { continue }
            }
            try {
                let c = await this.getClients(d.serial, timespan).then(res => res);
                c.map(client => client.device = d);
                //console.log('getClientsForNetwork d ', d);
                //console.log('getClientsForNetwork c ', c);
                clients = [...clients, ...c];
            } catch (e) { continue }
        }
        return clients;

    },

Thanks both! I suspected as much, it would be great to see as a feature later down the road....The API has alot of potential and is great for provisioning but lacking in other areas.

Get notified when there are additional replies to this discussion.