Community discussions

MUM Europe 2020
 
legrang
just joined
Topic Author
Posts: 22
Joined: Wed Nov 03, 2010 4:05 pm
Location: South Africa
Contact:

~ operator in API calls

Sun Jul 12, 2015 3:08 pm

Hello

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 http://wiki.mikrotik.com/wiki/Manual:API, 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
Gideon le Grange
RouterOS Java API: https://github.com/GideonLeGrange/mikrotik-java
 
User avatar
boen_robot
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 11 guests