Art-of-WiFi / UniFi-API-browser

Tool to browse data exposed by Ubiquiti's UniFi Controller API
MIT License
1.1k stars 150 forks source link

Hotspot Stats #80

Closed moose999 closed 4 years ago

moose999 commented 4 years ago

Hi,

Many thanks for your tool, and for any help you can give me. My question relates to the UniFi API more than it does your browser, so I would be extremely grateful for any help.

I am hoping you can help me list the stats from my Hotspot Payments with an API IDE - I'm using Postman.

I have installed the UniFi-API-browser, and i can see that:

SITENAME / Hotspot / stat payments / API function: stat_payment()

returns the information I need.

Using postman, I can get /api/s/SITEID/stat/device to list all my devices.

Following the list at https://ubntwiki.com/products/software/unifi-controller/api I am trying to run

/api/s/SITEID/hotspot

But I get api.err.InvalidObject

How do I work out the correct path to retrieve my hotspot stats from your source code - I guess its around the stat_payment function somehow... But I'm not a developer so I am stuck.

Many thanks again, Justin

malle-pietje commented 4 years ago

You're welcome. I'm afraid I can't support information posted on that WiKi you're referring to. Reilly Chase, the author of that section can probably help you further. He's reachable on Twitter as @_rchase_

I can only recommend you switch to the PHP API client which is what the API Browser tool uses below the surface: https://github.com/Art-of-WiFi/UniFi-API-client

Specifically this function/method: https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/src/Client.php#L1640-L1651

moose999 commented 4 years ago

Yes that's it! Many thanks for your time!

From your code I can see I need /api/s/SITEID/stat/payment - which works for me :)

Many thanks again, Justin

malle-pietje commented 4 years ago

You're welcome!