Community discussions

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

API "where in" syntax

Mon Jan 04, 2016 9:40 pm

Hi

I recently became aware that you can use a "in" operator in a command line query, for example:
/ip address print where address in 192.168.1.0/24
Is there a way to do this in the RouterOS API? I've read the API wiki page, but I can't see it, and haven't been able to figure it out with experimentation.

Gideon
Gideon le Grange
RouterOS Java API: https://github.com/GideonLeGrange/mikrotik-java
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5950
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: API "where in" syntax

Tue Jan 05, 2016 12:17 pm

Currently there is no such query in API.
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: API "where in" syntax

Wed Jan 06, 2016 6:56 pm

But could we hope to eventually get such support, or does this fall in the vain of regex in API queries (i.e. "No!")?

Unlike regex, this check isn't trivial on the client side (you have to parse the network address into a mask integer, then bitwise it against the address, also converted to an integer... not a trivial task in many languages), while it is such for the router (it does that pretty much all the time...), so I would hope that the (IMHO silly) excuse of "it's more efficient for the router to send the reply" does not apply here.

(As far as syntax goes, I think "?@address=192.168.1.0/24" would be best, and is consistent in form with other query operators; But I'd like any other syntax just as well)
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5950
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: API "where in" syntax

Mon Jan 11, 2016 1:52 pm

We are working on API improvements for ROS v7, so there is a big chance that such query will be possible.
 
legrang
just joined
Topic Author
Posts: 22
Joined: Wed Nov 03, 2010 4:05 pm
Location: South Africa
Contact:

Re: API "where in" syntax

Tue Aug 22, 2017 8:28 pm

18 months on I was again looking at this problem and a Google for an answer brought me to this thread. I've forgotten that I posted this.

It would have been funny if it wasn't so infuriating that the API still cannot do this.

Gideon
Gideon le Grange
RouterOS Java API: https://github.com/GideonLeGrange/mikrotik-java

Who is online

Users browsing this forum: No registered users and 15 guests