Datasheet
API Ruby class
188
>>> '!re' (3)
>>> '.id=*5' (6)
>>> 'name=ether1' (11)
>>> 'type=ether' (10)
>>> 'mtu=1500' (8)
>>> 'l2mtu=1500' (10)
>>> 'bytes=26908361008/15001379552' (29)
>>> 'packets=34880279/26382227' (25)
>>> 'drops=0/0' (9)
>>> 'errors=5/0' (10)
>>> 'dynamic=false' (13)
>>> 'running=true' (12)
>>> 'disabled=false' (14)
>>> 'comment=' (8)
>>> '.tag=4' (6)
>>> END-OF SENTENCE
>>> '!done' (5)
>>> '.tag=4' (6)
>>> END-OF SENTENCE
Command (/quit to end):
Did you see how the user properly prefixed the query parameter name with the query character (question mark ?)
and also paired it via = with the query value? With this example CLI, you must manually format all arguments as
specified by the MikroTik API.
You may have noticed that this Ruby API implementation automatically adds a unique .tag to every command.
That means if you specify a tag value, the Ruby code will ignore it and use its own. It adds a tag so that replies can
be correctly matched to the appropriate request.
Now here's the same query again, only add another parameter, =interval=1 so that the command will repeatedly
send output each second. To avoid the command continuing forever, it will be prefixed with 6: (this CLI script strips
the digit(s) and colon before sending the command to the device) to limit the number of response sentences to
exactly six before the interactive client will automagically issue an appropriate /cancel =tag=XYZ command to
cancel it.
Command (/quit to end): 6:/interface/getall ?name=ether1 =interval=1
=== COMMAND: /interface/getall ?name=ether1 =interval=1
<<< '/interface/getall' (17)
<<< '?name=ether1' (12)
<<< '=interval=1' (11)
<<< END-OF-SENTENCE
>>> '!re' (3)
>>> '.id=*5' (6)
>>> 'name=ether1' (11)
>>> 'type=ether' (10)










