Closed fsteinmann closed 1 year ago
Which firmware/UniFi OS version is running on the UDM PRO?
Please also update the first comment, it looks incomplete.
UnifiOS is 1.2.22.
Strange... GitHub didn't display all of my comment above. Here's the rest:
config.php is as follows:
'<?php '$controlleruser = 'my-username'; // the user name for access to the UniFi Controller '$controllerpassword = 'my-secret-password'; // the password for access to the UniFi Controller '$controllerurl = 'https://unifi.abcd.org'; // full url to the UniFi Controller, eg. 'https://22.22.11.11:8443', for UniFi OS-based ' // controllers a port suffix isn't required, no trailing slashes should be added '$controllerversion = '7.2.92'; // the version of the Controller software, e.g. '4.6.6' (must be at least 4.0.0) ' 'Browsing the API using the API browser leads to "Error loading sites or no sites available". I guess Ubiquiti has changed the 'API (again)...
I doubt there is an issue with the API. I’ve run tests against a UDR running these versions:
and that worked fine.
Do you have the full debug output from a login and fetching some data?
One of our customers is running UniFi OS version 1.2.22 with 7.2.92 with our captive portal connected to it using the PHP API client and that also works without any issues.
Which PHP version and php-curl version are you running?
Also, are you using a local administrator account? This blog post on our website explains how to set up a local account for use with the API: https://artofwifi.net/2022/04/07/how-to-access-the-unifi-controller-by-wan-ip-or-hostname-on-a-udm-pro/
I will have a thorough look tomorrow morning when I will have some more time. I have a local admin account, but with your comments I suspect it could be rather a set up issue with the web server rather the actual API. Will keep you posted. Thanks for looking into it this far!
Found it - it's completely unrelated to the API. Since UDM is both router and controller, IP address obviously changed, and DNS resolution for the unifi URL pointed to the WAN interface - but I have port forwarding in place, so the request ended up on the wrong web server and thus resulted in the 404. Thanks anyway for looking into it!
Authenticating against unifi fails miserably:
-----------LOGIN------------- Array ( [url] => https://unifi.abcd.org/api/auth/login [content_type] => text/html [http_code] => 404 [header_size] => 227 [request_size] => 195 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.002246 [namelookup_time] => 0.000117 [connect_time] => 0.000118 [pretransfer_time] => 0.000231 [size_upload] => 53 [size_download] => 1648 [speed_download] => 733748 [speed_upload] => 23597 [download_content_length] => -1 [upload_content_length] => 53 [starttransfer_time] => 0.000234 [redirect_time] => 0 [redirect_url] => [primary_ip] => 80.254.189.5 [certinfo] => Array ( )
)
----------RESPONSE-----------