Community discussions

MikroTik App
 
mkrz
just joined
Topic Author
Posts: 11
Joined: Fri Jan 17, 2020 10:53 am

[API] Need help with syntax for a few commands

Tue Dec 07, 2021 9:43 pm

I'm trying to add IP addresses to an address list in firewall using C++
Where I have an issue is in differences between CLI and API syntax

For example I can send a command like "/ip/firewall/address-list/add" and then it returns me an error message "failure: empty list name not allowed" which is fine but I don't know how to proceed after as I don't quite understand how do you set arguments?
In CLI an equal string will be:
"/ip/firewall/address-list> add address 192.168.88.100 list AllowedList comment ID-100"
and it works

But I just don't know or understand the syntax after the last command as '/' delimiter works only up until the actual last command before arguments it seems

I can't seem to find any good wiki, FAQ or docs on API anywhere - so any help with this example?
 
mkrz
just joined
Topic Author
Posts: 11
Joined: Fri Jan 17, 2020 10:53 am

Re: [API] Need help with syntax for a few commands

Wed Dec 08, 2021 12:09 am

Hmm seems like I figured this one out

/ip/firewall/address-list/add
=list=AllowedList
=address=192.168.88.100
=comment=ID-100

All need to be sent as separate "sentences" (aka char* / std::string.c_str() ) calling send() each time

Basically to set parameters in bulk like in CLI '=' needs to be used in place of a white space and device basically expects a key and a value per each send(). This is quite fine and logical, but I wish there was a better documentation with a lot more in-depth commands and "special symbols" explanation.

Now to figure out how to delete everything marked by an AllowedList

Who is online

Users browsing this forum: No registered users and 19 guests