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;
},