Skip to content

UnifiAPI.stat_session function not allowing single mac filtering #16

Description

@shankscoder

Comparing the stat_session function (show login sessions for clients), with the PHP version of the Unifi API class, I noticed that the PHP version lets you perform a search of sessions between a data range for a specific MAC. The NodeJS version doesn't accept a MAC as a parameter.

Node implementation

* List client sessions

PHP Implementation

https://github.com/Art-of-WiFi/UniFi-API-client/blob/master/src/Client.php#L669

An example of using this function call using the netsite function in NodeJS:

const moment = require('moment');

let conf = {
    mac: "<mac address>",
    'type': 'all',
    'start': moment().subtract(7, 'days').unix(),
    'end': moment().unix()
};

r.netsite('/stat/session', conf, {}, undefined, <sitecode>)
.then((data) => {
   console.log(data.data);
}).catch(err => console.log('Error',err));

Again will be issuing a pull-request soon, but documenting this here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions