delian / node-unifiapi

UniFi API ported to Node.JS

Repository from Github https://github.comdelian/node-unifiapiRepository from Github https://github.comdelian/node-unifiapi

Simple Example not working

GadgetUK opened this issue · comments

Using the following

let UnifiAPI = require('node-unifiapi'); let unifi = UnifiAPI({ baseUrl: 'https://127.0.0.1:8443', // The URL of the Unifi Controller username: 'ubnt', password: 'ubnt', debug: true, // More debug of the API (uses the debug module) // debugNet: true // Debug of the network requests (uses request module) }); unifi.login(username, password) .then(data => console.log('success', data)) .catch(err => console.log('Error', err))

I get the following output

root@gateway:~/unifi_tools# node --use-strict ./ap.js
/root/node_modules/node-unifiapi/index.js:68
UnifiAPI.prototype.netsite = function(url = '', jsonParams = undefined, headers = {}, method = undefined, site = undefined) {
^

SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/root/unifi_tools/ap.js:1:78)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

Ok, currently 4.8.x will look at updating to see if this resolves it.