node-unifiapi
node-unifiapi copied to clipboard
Bug in implementation of UnifiAPI.stat_sta_sessions_latest
So looks like there're some typos in this function, here: https://github.com/delian/node-unifiapi/blob/34662c589f2a9b0e8aa2069a2fd202e9be55476b/index.js#L332
The current code looks like so:
UnifiAPI.prototype.stat_sta_sessions_latest = function(mac = '', limit = 5, sort = '-asoc-time', site = undefined) {
return this.netsite('/stat/sessions', {
mac: mac.toLowerCase(),
'_limit': limit,
'_sort': sort
}, {}, undefined, site);
};
This returns an empty dataset, for 2 reasons:
- The API to call is going to
/stat/sessions
not/stat/session
. - The sorting parameter should be
-assoc_time
not-asoc-time
Putting this here right now as I'm still working through other calls to try and debug if there are any issues. If I aggregate a few more I'll create a pull request to consolidate these changes.
Ok, I will fix it. But if you find more problems, please tell
Delian
On Sun, Aug 5, 2018 at 3:14 PM Ashwin Shankar [email protected] wrote:
So looks like there're some typos in this function, here: https://github.com/delian/node-unifiapi/blob/34662c589f2a9b0e8aa2069a2fd202e9be55476b/index.js#L332
The current code looks like so:
UnifiAPI.prototype.stat_sta_sessions_latest = function(mac = '', limit = 5, sort = '-asoc-time', site = undefined) { return this.netsite('/stat/sessions', { mac: mac.toLowerCase(), '_limit': limit, '_sort': sort }, {}, undefined, site); };
This returns an empty dataset, for 2 reasons:
- The API to call is going to /stat/sessions not /stat/session.
- The sorting parameter should be -assoc_time not -asoc-time
Putting this here right now as I'm still working through other calls to try and debug if there are any issues. If I aggregate a few more I'll create a pull request to consolidate these changes.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/delian/node-unifiapi/issues/15, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG7ZkduvrKL-AKL_ZhHyYgfoqS7AJByks5uNuGJgaJpZM4VvWnY .