GithubHelp home page GithubHelp logo

Comments (14)

delian avatar delian commented on May 22, 2024 2

from node-unifiapi.

BobFrankston avatar BobFrankston commented on May 22, 2024 1

The PHP version seems short enough to rewrite if need be. I also found https://ubntwiki.com/products/software/unifi-controller/api. My goal is still to have a TypeScript (OK, JavaScript) library that I can use. My bias shows in https://rmf.vc/IEEEJSEco.

from node-unifiapi.

malle-pietje avatar malle-pietje commented on May 22, 2024

@lifewcody Same here. Apparently with the addition of UDM PROs the routes for the software-based controllers have changed. Have you been able to make any progress?

FYI: I maintain the PHP API client for UniFi but have a specific use-case where we may need to leverage CloudAccess and it would be really cool if we can achieve that with this package.

from node-unifiapi.

BobFrankston avatar BobFrankston commented on May 22, 2024

This is one of the two big issues slowing my adoption of the UDM pro. The other is that /etc/hosts isn't getting populated but, with an API, I can think about programming a work-around.

from node-unifiapi.

malle-pietje avatar malle-pietje commented on May 22, 2024

@BobFrankston If you have PHP skills you can always start off with the PHP API client which I maintain and already supports UDM PROs.

from node-unifiapi.

BobFrankston avatar BobFrankston commented on May 22, 2024

Thanks -- I'll see if I can figure out the fix to apply it to the node version but I'm hesitant to try to update the shared version.

from node-unifiapi.

BobFrankston avatar BobFrankston commented on May 22, 2024

@malle-pietje - Since I'm not up to speed on the PHP ecosystem, do you have a simpler example I can use to invoke the PHP library? I'm getting authorization issues on the UDM Pro. There seems to be a myriad of credentials) and I don't know if I have the bug in my JS code or not.

from node-unifiapi.

malle-pietje avatar malle-pietje commented on May 22, 2024

@BobFrankston the issue with UDM PROs is that the login route and base path have changed. Also the authentication uses a JWT token instead of cookies. Just search through the code for the is_unifi_os property to see where we change behavior of the client:
https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/src/Client.php

from node-unifiapi.

BobFrankston avatar BobFrankston commented on May 22, 2024

Thanks. I did find /api/auth/login. The challenge now is to figure out which credentials for what since that too has changed. There are local credentials, UDM credentials, cloud credentials ... but I did get to authorization failure which is progress.

from node-unifiapi.

malle-pietje avatar malle-pietje commented on May 22, 2024

@BobFrankston When accessing the (non-Cloud) API you need to use a set of credentials for the UniFi controller application with local access permissions.

from node-unifiapi.

BobFrankston avatar BobFrankston commented on May 22, 2024

I added local credentials and tried both that and the cloud credentials which the UDM pro seems to want. Do you have a command line I can use with your PHP version so I can test the credentials? I do appreciate your help and the work you've done.

from node-unifiapi.

malle-pietje avatar malle-pietje commented on May 22, 2024

@BobFrankston You can use this example which can easily be executed from the command line after setting up the config file:
https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/examples/list_user_stats.php

Execute like so:

# php list_user_stats.php 

from node-unifiapi.

BobFrankston avatar BobFrankston commented on May 22, 2024

I've made lots of progress and added:

CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYPEER => false,

but now need to get past

PHP Notice:  cURL error: SSL: no alternative certificate subject name matches target host name

from node-unifiapi.

BobFrankston avatar BobFrankston commented on May 22, 2024

OK, got past that with

CURLOPT_SSL_VERIFYHOST => FALSE,
CURLOPT_SSL_VERIFYPEER => FALSE,

On to the next challenge ...

from node-unifiapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.