I'd like to retrieve the the count of each type of client for a network during a time span -- e.g., how many VPN, wired, and wireless.
Is the correct way to do so (currently, in the v0 API) to use:
/networks/{networkId}/clients
Then parse through them and count:
if switchport
wired user
elif ssid
wireless user
else
vpn user
I don't know if this will deterministically identify these "types" of users though.
Do you have any MXs that have clients connected directly to them either wired or wireless? Because those may also need to be considered then.
If I were you I'd experiment a bit to observe the behavior.
You'll need to do a rummage in the JSON return, but something roughly like that should work. VPN users look to have an SSID of null (obviously), and a vlan of 0.
@boomi wrote:
Yep, I've been getting used to just looking at output over and over until I find exceptions 🙂
I would laugh except then I'd start crying because yes, this is in fact my life when writing stuff. Find my client who is the most X, then look at the outputs for that until I start finding the weird stuff.
I'd joke that I dream about parsing JSON with Python sometimes except, you know, I actually do. I guess I'm a real programmer now, huh?