Reply
Regular Member
Posts: 526
Registered: ‎01-28-2016
Kudos: 117
Solutions: 17

Re: UniFi API browser tool: updates and discussion

Veteran Member
Posts: 4,966
Registered: ‎06-13-2015
Kudos: 1343
Solutions: 234

Re: UniFi API browser tool: updates and discussion

[ Edited ]

Cross-posting here in case you’re not subscribed to the other thread.

 

I pushed another update of the API client class to GitHub today:

 

API client class v1.1.38

  • made regex to extract cookies case-insensitive, while this would only be needed for corner cases this is still RFC compliant (https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2), thanks to @ericfri
  • changed the layout of the README file to put more emphasis on the installation options and the basic example, and less on the list of methods/functions

 Enjoy!

 

Art of WiFi
Check out our UniFi API browser tool on GitHub. The PHP API client which it uses, can be found here on GitHub.
The thread on our UniFi Device Search tool can be found here, also check out our Captive Portal solutions for UniFi.
Veteran Member
Posts: 4,966
Registered: ‎06-13-2015
Kudos: 1343
Solutions: 234

Re: UniFi API browser tool: updates and discussion

 

I pushed an update of the API browser tool to GitHub today:

 

API browser version 1.0.35

  • code cleanup based on analysis by [Scrutinizer](https://scrutinizer-ci.com/)
  • included PHP API client class v1.1.38
  • minor UX tweaks applied to alerts and the login form

 Enjoy!

 

Art of WiFi
Check out our UniFi API browser tool on GitHub. The PHP API client which it uses, can be found here on GitHub.
The thread on our UniFi Device Search tool can be found here, also check out our Captive Portal solutions for UniFi.
New Member
Posts: 18
Registered: ‎09-14-2018
Kudos: 2

Re: UniFi API browser tool: updates and discussion

Just curious  I am just digging into the API

 

I am playing with list_guests()  What is the  expired column for?  I have some set to Yes and all others no.  and the one yes  is a staff member with a 1 year voucher  so  I am a bit confured.  The voucher is for 1 device only.

 

 

I am also trying to write a report to look for WIFI squatters who continually go and get a new voucher.  Our policy is 1 voucher per day we do not want to  have this issue again like our last wide open wifi network.

 

Which parts of the API would I need to look at?

 

Thanks

 

 

Veteran Member
Posts: 4,966
Registered: ‎06-13-2015
Kudos: 1343
Solutions: 234

Re: UniFi API browser tool: updates and discussion


@DiscusZ wrote:

Just curious  I am just digging into the API

 

I am playing with list_guests()  What is the  expired column for?  I have some set to Yes and all others no.  and the one yes  is a staff member with a 1 year voucher  so  I am a bit confured.  The voucher is for 1 device only.

 

 

I am also trying to write a report to look for WIFI squatters who continually go and get a new voucher.  Our policy is 1 voucher per day we do not want to  have this issue again like our last wide open wifi network.

 

Which parts of the API would I need to look at?

 

Thanks

 

 


@DiscusZ As far as I can tell the expired column/property indicates the authorization status of the device. I cannot comment on that specific staff device without seeing the full collection.

 

But I think you’re not approaching the issue in the correct/easiest manner. In your case I would enable paid vouchers, configure one of the payment providers with dummy data and create a trial voucher with the correct Trial Lockout period. That should present the users with a single option: a trial voucher with the restrictions applied as required.

Art of WiFi
Check out our UniFi API browser tool on GitHub. The PHP API client which it uses, can be found here on GitHub.
The thread on our UniFi Device Search tool can be found here, also check out our Captive Portal solutions for UniFi.
New Member
Posts: 18
Registered: ‎09-14-2018
Kudos: 2

Re: UniFi API browser tool: updates and discussion

[ Edited ]

Hmm  a trial..  I have not even thought or looked at that option at all!   That is a great idea..  I will look into that as well.  


@slooffmaster wrote:

@DiscusZ wrote:

Just curious  I am just digging into the API

 

I am playing with list_guests()  What is the  expired column for?  I have some set to Yes and all others no.  and the one yes  is a staff member with a 1 year voucher  so  I am a bit confured.  The voucher is for 1 device only.

 

 

I am also trying to write a report to look for WIFI squatters who continually go and get a new voucher.  Our policy is 1 voucher per day we do not want to  have this issue again like our last wide open wifi network.

 

Which parts of the API would I need to look at?

 

Thanks

 

 


 

But I think you’re not approaching the issue in the correct/easiest manner. In your case I would enable paid vouchers, configure one of the payment providers with dummy data and create a trial voucher with the correct Trial Lockout period. That should present the users with a single option: a trial voucher with the restrictions applied as required.


 

Veteran Member
Posts: 4,966
Registered: ‎06-13-2015
Kudos: 1343
Solutions: 234

Re: UniFi API browser tool: updates and discussion

Cross-posting here in case you’re not subscribed to the other thread.

 

I pushed another update of the API client class to GitHub today:

 

API client class v1.1.39

  • added function/method assign_existing_admin()
  • fixed code for function/method invite_admin()
  • minor code tweaks for improved readability

Enjoy!Icon Biggrin

 

PS: a new version of the API browser which bundles the above API client version will follow shortly

Art of WiFi
Check out our UniFi API browser tool on GitHub. The PHP API client which it uses, can be found here on GitHub.
The thread on our UniFi Device Search tool can be found here, also check out our Captive Portal solutions for UniFi.
Veteran Member
Posts: 4,966
Registered: ‎06-13-2015
Kudos: 1343
Solutions: 234

Re: UniFi API browser tool: updates and discussion

Cross-posting here in case you’re not subscribed to the other thread.

 

I pushed another update of the API client class to GitHub today:

 

API client class v1.1.40

  • fixed functions assign_existing_admin() and invite_admin() to support controller versions 5.9 and higher because of observed changes in controller behavior

 Enjoy!Icon Biggrin

 

Art of WiFi
Check out our UniFi API browser tool on GitHub. The PHP API client which it uses, can be found here on GitHub.
The thread on our UniFi Device Search tool can be found here, also check out our Captive Portal solutions for UniFi.
New Member
Posts: 1
Registered: ‎05-22-2015
Kudos: 1

Re: UniFi API browser tool: updates and discussion

This is awesome, thanks.  I've been able to containerize this and run in in my AKS instance if anyone is interested, i can provide the docker build file I used.

Veteran Member
Posts: 4,966
Registered: ‎06-13-2015
Kudos: 1343
Solutions: 234

Re: UniFi API browser tool: updates and discussion

@msemkiw  You're welcome and thanks for the contribution!Icon Biggrin

Art of WiFi
Check out our UniFi API browser tool on GitHub. The PHP API client which it uses, can be found here on GitHub.
The thread on our UniFi Device Search tool can be found here, also check out our Captive Portal solutions for UniFi.
Veteran Member
Posts: 4,966
Registered: ‎06-13-2015
Kudos: 1343
Solutions: 234

Re: UniFi API browser tool: updates and discussion

[ Edited ]

I pushed an update of the API browser tool to GitHub today:

 

API browser version 1.0.36

  • added support for list_all_admins() function/method
  • added function/method used to output header
  • included PHP API client class v1.1.40
  • cleaned up the indentation across all of index.php

 Enjoy!

 

Art of WiFi
Check out our UniFi API browser tool on GitHub. The PHP API client which it uses, can be found here on GitHub.
The thread on our UniFi Device Search tool can be found here, also check out our Captive Portal solutions for UniFi.
New Member
Posts: 1
Registered: ‎12-28-2018

Re: UniFi API browser tool: updates and discussion

[ Edited ]

Thanks for this great tool! I was wondering if it's possible to list information from all sites at once? I did some searching and and found some replies you've made on other threads. It looks like it's possible but I'm not quite sure how to do it.

 

Edit: Also saw your other tool that shows devices across all sites. I would happily buy a license if you could add connected clients!

Veteran Member
Posts: 4,966
Registered: ‎06-13-2015
Kudos: 1343
Solutions: 234

Re: UniFi API browser tool: updates and discussion


@jgorin wrote:

Thanks for this great tool! I was wondering if it's possible to list information from all sites at once? I did some searching and and found some replies you've made on other threads. It looks like it's possible but I'm not quite sure how to do it.

 

Edit: Also saw your other tool that shows devices across all sites. I would happily buy a license if you could add connected clients!


@jgorin You're welcome!

 

The main purpose of the API browser tool is to serve as a tool for developers by providing insights into the various data collections that are available through the controller API.

 

The other tool you refer to (UniFi Device Search tool) is developed specifically for users looking to collect information for all the UniFi devices managed on one or more controllers while also being able to quickly find one or more devices by using a variety of queries and filters. It does not have a focus on clients I'm afraid.

 

Of course, there is nothing stopping you from writing your own custom script which does the following:

  • fetch all sites hosted on a controller
  • cycle through the sites, then
  • for each site fetch the connected clients

The challenge lies in merging the collected data before presenting it to the user while limiting the load on the controller.

Art of WiFi
Check out our UniFi API browser tool on GitHub. The PHP API client which it uses, can be found here on GitHub.
The thread on our UniFi Device Search tool can be found here, also check out our Captive Portal solutions for UniFi.
New Member
Posts: 8
Registered: ‎02-15-2019

Re: UniFi API browser tool: updates and discussion

[ Edited ]
 
New Member
Posts: 8
Registered: ‎02-15-2019

Re: UniFi API browser tool: updates and discussion

Hello everyone!

Can you guys tell me if there is a way that I can get the "Current Usage: Top Access Points" data at the API? and onme more question. Can I get alerts just from the last 30 days?

Thank  you!

Veteran Member
Posts: 4,966
Registered: ‎06-13-2015
Kudos: 1343
Solutions: 234

Re: UniFi API browser tool: updates and discussion


@Joao08 wrote:

Hello everyone!

Can you guys tell me if there is a way that I can get the "Current Usage: Top Access Points" data at the API? and onme more question. Can I get alerts just from the last 30 days?

Thank  you!


@Joao08 I assume the double-post was a mistakeIcon Wink

 

Can you tell where you see this "Top Access Points" information in the UniFi controller UI?

 

Regarding your last question: do you mean alarms/alerts or events?

 

Alerts cannot be selected by date:

https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/src/Client.php#L2854-L2868

 

Events can:

https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/src/Client.php#L2854-L2868

but to fetch these selectively you will need to create your own code using the PHP API client.

Art of WiFi
Check out our UniFi API browser tool on GitHub. The PHP API client which it uses, can be found here on GitHub.
The thread on our UniFi Device Search tool can be found here, also check out our Captive Portal solutions for UniFi.
New Member
Posts: 8
Registered: ‎02-15-2019

Re: UniFi API browser tool: updates and discussion

So, I need to get the information in Statistcs (Overview) / Current Usage: Top Access Points.

 

About the other question thank you for your help Man Happy

New Member
Posts: 8
Registered: ‎02-15-2019

Re: UniFi API browser tool: updates and discussion

Hello!

I'm trying to get some information in API but I don't know if I can do that. 

The information tha I want is located at "statistics (overview) / Current Usage: Top Access Points".

Anyone know how can I get the traffic stats?

Thank you!

 

Veteran Member
Posts: 4,966
Registered: ‎06-13-2015
Kudos: 1343
Solutions: 234

Re: UniFi API browser tool: updates and discussion


@Joao08 wrote:

Hello!

I'm trying to get some information in API but I don't know if I can do that. 

The information tha I want is located at "statistics (overview) / Current Usage: Top Access Points".

Anyone know how can I get the traffic stats?

Thank you!

 


@Joao08 use the list_devices() function from our PHP API client which will return an array containing an associative array for each device. There the metric you are looking for for a specific device is:

$device_array[0]['stat']['tx_bytes']

Where 0 is the index for the device in the array that is returned by the function.

Art of WiFi
Check out our UniFi API browser tool on GitHub. The PHP API client which it uses, can be found here on GitHub.
The thread on our UniFi Device Search tool can be found here, also check out our Captive Portal solutions for UniFi.
Highlighted
New Member
Posts: 8
Registered: ‎02-15-2019

Re: UniFi API browser tool: updates and discussion

It works, thank you! But i need to add tx_bytes with rx_bytes of every Acess Point Man Happy

Reply