Comments (9)
I checked the PHP docs and it turns out when using empty() there is no need to also use isset() as test.
http://php.net/manual/en/function.empty.php
Using empty() widens the scope of the test a bit to also test for "false" so it should do the trick.
from unifi-api-browser.
I have not seen this error before. Which PHP and cURL versions are you using?
from unifi-api-browser.
I was able to reproduce this. It is due to a bit of a session confusion.
I tried connecting to UBNT 3.2.10 at first (I know the comments say 4.0.0 minimum, but I had to try before going through that hassle :P). I started getting 401s from the API, which did not register with the code as being a failed request (it looks for 400, so must be difference from old controller versions), so it tries to continue. This allowed list_sites()
to fail to get any sites, returning false
, and storing it in the session.
I then upgraded the controller to 4.8.20, and refreshed the page. Since the session variable $_SESSION['sites']
was already set, and equaled false
, it sets $sites = $_SESSION['sites'];
, which is what ends up breaking the foreach
loop.
My suggestion is the change this line. on index.php:182
if (isset($_SESSION['sites']) || $_SESSION['sites'] === '') {
To:
if (isset($_SESSION['sites']) || empty($_SESSION['sites'])){
This allowed the sites from my updated controller to be pulled in correctly.
from unifi-api-browser.
Thanks for the feedback: seems to make sense to do it like this. I will test this change and include if all goes well.
from unifi-api-browser.
Hello, i updated my unifi controller to 5.2.2 and suddenly it works... i put an .htpasswd simple http authorization on the app because it shows the ssh password of the aps and operator of hotspot...
@malle-pietje very nice job dude!!!! i want to collaborate with the project, would you be interested in an external app to do different stuff in unifi? i can help in angularJs frontend...
from unifi-api-browser.
There is popular demand for a reporting tool: where the API Browser tool is really a tool for developers there are quite a lot of non-technical users that want to have a tool that produces tabular reports (e.g. using DataTables) on the most relevant data collections/API endpoints. Such a tool should allow the user to select/deselect columns and a select a time range (e.g. using DataRangeSelector).
I have some idea's for this but just can't find the time to develop it.
from unifi-api-browser.
@facuxt Would be nice if you would be able to spend some time on that...:-)
from unifi-api-browser.
maybe we can form some kind of project... i need that kind of reporting tool... with the api you can get historical data? for example from the unifi controller you just can get only 30 days ago... There is any documentation of the api?
i'll look forward to it... @enzogro
from unifi-api-browser.
Would be nice project to work on. The API can report on historical data as long as it's available from the controller. There is no documentation but I have made an effort in providing a start by adding comments to the functions in the class.unifi.php
file.
from unifi-api-browser.
Related Issues (20)
- 24hr usage HOT 2
- Any documentation available? HOT 2
- All devices HOT 3
- Removing users across all sites HOT 1
- UI Cloud Controller integration HOT 3
- Permission denied (13) when loading sites HOT 9
- Unable to get list of sites from local UCG Ultra HOT 1
- Default Site / Collection HOT 4
- Connection Error HOT 2
- How can I see all energy (watts) being usage on the network HOT 1
- UniFi controller login failure HOT 4
- Is there any way to display the results directly? HOT 4
- API IP from VPN HOT 7
- UDM Pro firmware beta version 1.11.0-14 and 1.11.0-15 HOT 2
- API does'nt work need help HOT 7
- Access to WLAN password HOT 15
- Possible issue with CORS HOT 3
- Demo not working HOT 2
- Unifi 7.0 Controller API Issue HOT 3
- Node lacks support for Ubiquiti power strips and plugs. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unifi-api-browser.