API - HotSpot Active Users

I’m using API with command “/ip/hotspot/active/print” to get statistic from my HotSpot servers.

In statistic I have server, username, address, mac-address, uptime, bytes-in, bytes-out.

And everything works fine from v3.22 to v4.6 RouterOS.

This is array from v3.22 to v4.6 RouterOS.

[0] => Array
        (
            [.id] => *304A8C0
            [server] => ******
            [user] => ******
            [address] => ******
            [mac-address] => ******
            [login-by] => http-chap
            [uptime] => 00:13:18
            [idle-time] => 00:00:00
            [idle-timeout] => 00:30:00
            [bytes-in] => 1005538
            [bytes-out] => 13072457
            [packets-in] => 7409
            [packets-out] => 10971
            [radius] => true
        )

But now at version 4.10 RouterOS I dont have: bytes-in, bytes-out

[0] => Array
        (
            [.id] => *6491759
            [server] => ******
            [user] => ******
            [address] => ******
            [mac-address] => ******
            [login-by] => http-chap
            [uptime] => 00:03:10
            [keepalive-timeout] => 00:02:00
            [radius] => true
        )

I find solution… :slight_smile:

In versions from 3.22 to 4.6 i use (in PHP)

$API->write('/ip/hotspot/active/print');
$ARRAY = $API->read();

And my result was:

[0] => Array
        (
            [.id] => *304A8C0
            [server] => ******
            [user] => ******
            [address] => ******
            [mac-address] => ******
            [login-by] => http-chap
            [uptime] => 00:13:18
            [idle-time] => 00:00:00
            [idle-timeout] => 00:30:00
            [bytes-in] => 1005538
            [bytes-out] => 13072457
            [packets-in] => 7409
            [packets-out] => 10971
            [radius] => true
        )

Now in version 4.10 I must add parameter ‘=stats=’ to API command

$API->write('/ip/hotspot/active/print',false);
$API->write('=stats=');
$ARRAY = $API->read();

Now everything works fine!