Page 1 of 1

Help needed using Query in API

Posted: Mon Aug 17, 2015 8:48 pm
by rcourtney
I will be using the API to upload users/passwords to the routers for apartment buildings.

So far the path /ip/hotspot/users/add
with numbers=n,name=userid,password=userpass (n is a number 0 to 31 reflecting bins for tennants)
adds new users.

/ip/hotspot/users/remove
with numbers=n
removes the bin entry.

I need to know how to do a query so I can retrieve the router's current information for fair use reporting, etc.

Can anyone supply me with an example?


I am basing my code off of this c++ code project:
https://github.com/silderan/QMikrotikAPI/

Re: Help needed using Query in API

Posted: Mon Aug 17, 2015 9:13 pm
by boen_robot
How would you receive it if you were "manually" reading it from a terminal?

Are you talking about the bytes-in/bytes-out info at that same menu? Just do a print request:
/ip/hotspot/user/print
If you want to read only a particular user, you can use the "from" argument, e.g.
/ip/hotspot/user/print
=from=username
Or if you want to read all users matching criteria, you can use a query with the criteria, e.g. to display all users that have uploaded more than 2GiB of data:
/ip/hotspot/user/print
?>bytes-out=2147483648

Re: Help needed using Query in API

Posted: Tue Aug 18, 2015 5:00 am
by rcourtney
Your post helped.
/ip/hotspot/user/getall getall instead of print
I need to filter either by numbers (I use bin position in place of the apartment number)

Thanks