20.10.2020, 17:16
(This post was last modified: 20.10.2020, 17:16 by gjniewenhuijse.)
(20.10.2020, 06:57)admin Wrote: Use attached code to create a user library named mikrotik.-- get wireless registration table if you use capsman
Make sure that your router is running at least v6.43.
It is recommended to create a separate user for api access, possibly with limited read-only access if you don't need to change anything on the router remotely.
Example:
Code:mt, err = require('user.mikrotik').new('192.168.1.1')
if mt then
res, err = mt:login('api', '123456') -- user api, pass 123456
if res then
-- get wireless registration table
res, err = mt:readlist('/interface/wireless/registration-table/print')
log(res)
else
log('login failed', tostring(err))
end
mt:close()
else
log('connect failed', tostring(err))
end
/caps-man/registration-table/print