Page 1 of 1

API "where in" syntax

Posted: Mon Jan 04, 2016 9:40 pm
by legrang
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

Re: API "where in" syntax

Posted: Tue Jan 05, 2016 12:17 pm
by mrz
Currently there is no such query in API.

Re: API "where in" syntax

Posted: Wed Jan 06, 2016 6:56 pm
by boen_robot
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)

Re: API "where in" syntax

Posted: Mon Jan 11, 2016 1:52 pm
by mrz
We are working on API improvements for ROS v7, so there is a big chance that such query will be possible.

Re: API "where in" syntax

Posted: Tue Aug 22, 2017 8:28 pm
by legrang
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