Community discussions

MikroTik App
just joined
Topic Author
Posts: 23
Joined: Wed Nov 03, 2010 4:05 pm
Location: South Africa

~ operator in API calls

Sun Jul 12, 2015 3:08 pm


I wrote and maintain a OSS Java library for the RouterOS API and received the following query from a user:
Im trying to use the following commands bellow but i'm getting a grammar error:
/ip/dhcp-server/lease/print where comment ~'#Router#'
/ip/dhcp-server/lease/print where comment ~'^#Router#'

(The first command lists registers that contains the string "#Router#" inside the comments and the second the registers that starts with this string.)

It works OK in winbox:
/ip dhcp-server lease print where comment ~"#Router#"
/ip dhcp-server lease print where comment ~"^#Router#"

Is it an API limitation or a bug???

When I read the API documentation, it looks as if there is no way of creating a print with a "~" query.

Is this by design? Are there any plans to expand the available queries in future?

Many thanks
Gideon le Grange
RouterOS Java API:
User avatar
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: ~ operator in API calls

Sun Jul 12, 2015 5:02 pm

You too, huh?

See this topic. In short - it's by (bad!) design, and MikroTik stubbornly refuse to implement it for (silly) reasons.
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)

Who is online

Users browsing this forum: No registered users and 28 guests