Closed tom26230 closed 4 months ago
Please share the full exact URL you’re using to connect to the controller. Feel free to only change the IP address or hostname.
Hmm, somehow an incorrect URL appears to be passed. Please double check your code and enable debug mode to see what is happening.
I also have another controller with the URL https://10.0.10.30:8443 but this is the same. I use the configuration file provided, without any modification apart from the controller information
const CLASS_VERSION = '1.1.80';
protected $baseurl = 'https://10.100.10.50:8443';
protected $user = 'api-login';
protected $password = 'api-password';
protected $site = 'default';
protected $version = '7.5.187';
I'm in a test environment and the api-login user is the local administrator of the Unifi controller, so there's no SSO or remote login.
In any case, I am infinitely grateful for your prompt reply.
Hmm, please enable debug mode and share the full (but sanitized) output that you get when trying to login and fetch a collection, such as the sites.
I also have another controller with the URL https://10.0.10.30:8443 but this is the same. I use the configuration file provided, without any modification apart from the controller information
const CLASS_VERSION = '1.1.80'; protected $baseurl = 'https://10.100.10.50:8443'; protected $user = 'api-login'; protected $password = 'api-password'; protected $site = 'default'; protected $version = '7.5.187';
I'm in a test environment and the api-login user is the local administrator of the Unifi controller, so there's no SSO or remote login.
In any case, I am infinitely grateful for your prompt reply.
Wait a minute... How are you configuring the URL and credentials to access the controller? From the above code, it looks as if you are editing the Client.php
file.
You should not be doing that. Please use a separate config file as explained in the examples directory: https://github.com/Art-of-WiFi/UniFi-API-client/tree/master/examples
Hello, I have a problem with the example files provided with the API client. I'm trying to test the API by executing the php file that lists the sites and I get this return in my console
What alarms me most is:
PHP Notice: HTTP response status received: 400. Probably a controller login failure in /var/www/guest/s/default/vendor/art-of-wifi/unifi-api-client/src/Client.php on line 206
I've tested the API browser and it connects without a hitch. I created a new virtual controller but it's the same. Any idea how to debug this?
I'm sure it's a configuration problem on my side but I can't find it and I've been looking for a week when I get home from work and my wife is getting fed up!
Thanks