Client endpoint

japanet
Comes here often

Client endpoint

Hello,

We would like to know how many clients are connected to a network. There's an API call we can make to get this information, but the request is made by AP serial (GET /devices/[serial]/clients)

The problem is, we have an Organization that has 100+ networks and each network has dozens of AP's, so we would have to make more then 600 requests to get the number of clients of a single organization. That is very time consuming as meraki API has a limitation of 5 requests per second.

Isn't there a better way to get the number of clients connected to a network ?

Maybe a call like (GET /[networkId]/clients)

I've done some research and the best alternative is to use the scanning API, but this endpoints retrieves all the equipments the beacon can "see". I'm only interested in the connected/authenticated ones.


If it doesn't exists, is there a possibility of providing it as a new feature ?


Thanks

6 REPLIES 6
HodyCrouch
Building a reputation

You're talking about 3 minutes to go through the entire organization.  I don't know your exact use case, but that doesn't sound 'very time consuming' to me.

 

The Scanning API includes the ssid parameter.  If you only want to track the connected clients, simply filter out the records with a empty ssid in the data you receive from the Scanning API.

 

If you want to review data from yesterday, last week, or last month, you can use the Organization Summary Report.

PhilipDAth
Kind of a big deal
Kind of a big deal

PhilipDAth
Kind of a big deal
Kind of a big deal

 

Status Code from the endpoint below: 404 Not found, tried it with and without paremeters and with multiple networkId's.

None of them worked

 GET /networks/[networkId]/connectionStats?t0=1&t1=3600

 

I think these endpoints are not working anymore

HodyCrouch
Building a reputation

I had to submit a case to Meraki support to get access to the Wireless Health APIs.  Until then, I received a 404 on any requests to that set of APIs.

 

Also, make sure you use valid values for t0 and t1.  I don't think you can submit 0 and 3600 (as you did in your example) to get the last hour.  Instead, you need to specify unix epoch values (see https://www.epochconverter.com/ if you are unfamiliar).

 

@PhilipDAth - I played around with connectionStats in hope that it would provide client counts or connection status for specific clients.  As far as I can tell, that's not what the API does.  Instead, the API provides the same type of information shown in the dashboard UI for Wireless Health.  The connectionStats object only seems to show information when a client attempted to establish a connection during the specified time window.

 

For example, one of my networks has 8 active clients.  When I query connectionStats for the last hour, I receive an empty array as a reply.  If I query for the last 3 hours, I only see a single entry for a device that happened to disassociate and re-associate at that time.

 

Unless I'm missing something, I don't see how the Wireless Health APIs can provide current client status information.

JohnTr
Conversationalist

Hi HodyCrouch,

 

I'm having some issues with get client calls and timespans myself.  

 

I'm accessing the Meraki API with a python (v3) script.  I've refered to the Meraki API documentation and source code found here: https://github.com/meraki/dashboard-api-python/blob/master/meraki.py

 

The particular call I'm using is found on line 1349 "def getclients(apikey, serialnum, timestamp=86400, suppressprint=False😞"

 

I want to see all the clients connected to a particular MX device over the last month.  It's the timespan piece that I don't understand.  For example:

 

networkClients = meraki.getclients(apikey, greeceNodes[node])

 

Here the networkClients is meant to be a returned list of clients and greeceNodes[node] is the serial number of an MX device in my Greek networks.   That said, I'm not sure where to put the timespan or how to format it, and the source code is not clear about it.  

 

on lines 1353 - 1355 of the source code, the timespan={2}:

 

geturl = '{0}/devices/{1}/clients?timespan={2}'.format(str(base_url),
 str(serialnum),
 str(timestamp))

 

 

I'm not sure what this timespan={2} means.

 

Any ideas on how to gather data from the monthly timespan?

 

 

Get notified when there are additional replies to this discussion.