-----Original Message----- From: Public [mailto:public-bounces@talk.mikrotik.com.au] On Behalf Of Mike Everest Sent: Sunday, 27 April 2014 10:37 AM To: public@talk.mikrotik.com.au Subject: [MT-AU Public] API Wildcard search
Hi folks,
Anyone have some experience using routerOS API?
I've been extending the configuration group functionality of our DuxTel Commander, and come up against a challenge in filtering API query (http://wiki.mikrotik.com/wiki/API#Queries)
The deal is that I use 'comment' field as a way to cross-reference router configuration entries with the configuration database items. For example, a firewall rule might look like:
ip firewall filter add chain=forward src-address-list=blocked action=drop comment='Managed by DuxAdmin SetID:443 ItemID:27'
So when I want to find all the firewall rules with SetID:443, I can do
Hi folks! Further to my original post (below) I have had some further correspondence with MT (Janis K) regarding these questions, but really getting nowhere useful yet ;-) At least I have been able to confirm that there is no wildcard or regex feature in API query structure (apparently 'regex is not available via API in any form' ;-) and the suggested approach is to download the entire data to the client and parse client side, which is quite a PITA for the implementation that we are building here :( I am yet to get any sensible description of how the operators '<' and '>' actually work on text at all (i.e. is it like strcmp kind of functionality, or something else?) but taking my usual tack when dealing with MT support and just repeating the question over and over until they offer an answer that addresses the actual question! :-D When I get such a result, I will post again to this thread for prosperity of all! Cheers, Mike. this:
/ip/firewall/filter/find ?>comment=Managed by DuxAdmin SetID:443
Which seems to work OK, but I can't work out how to return just those
entries
that include 'ItemID:27'
I'll put the question to MT support and post a solution (if there is one) if/when they respond, but if anyone has some suggestions, I'm 'all ears'! ;-)
Cheers, Mike.