Datasheet

API multiplatform from townet
84
MKDeal - tool di interfaccia mikrotik uso: MKDeal ip utente password -c comando (per comandi one-shot) MKDeal
ip utente password -i comando (per gestire comandi interattivi) MKDeal -f nomefile -c comando (per gestire
comandi su piu' board)
Il file deve avere come formato IP#USER#PASS su ogni riga
risposte: NUM Err oppure NUM Ok seguito dai dati -1 : parametri errati -2 connessione fallita -3 trap generica -4
password errata -5 trap su comando 0 corretto
Some example:
./mik 192.168.1.1 admin rtmtc -c /ip/address/print -2 Err L'indirizzo indicato non risponde
In the upper example the boars is not properly connected to the network or the API is disabled.
$ ./mik 192.168.1.39 admin "" -c /ip/adress/print -5 Err !trap =category=0 =message=no such command or directory
(adress)
<STR>!trap =message=no such command prefix
<STR>!done <STR>
In the upper example we have a trap: the command i used is not existing (i wrote address with a single d).
$ ./mik 192.168.1.39 admin "" -c /ip/address/print [*** Errore ***] [This board is not enabled for API Townet]
This is what happens when the board is connected to the network, but the code to enable it for using the API townet
is not installed. The MkApi library is in fact working only on townet/wispmax machines. Forother machine its
possible to ask an activation code to townet giving us the serial number and license-id of the board, and the model.
There isnt an error code because the API didnt return a result, non allowing the access.
$ ./mik 192.168.1.39 admin "" -c /ip/address/print 0 Ok !re =.id=*3 =comment=aaa =address=10.10.10.1/24
=network=10.10.10.0 =broadcast=10.10.10.255 =interface=ether1
<STR>!re =.id=*4 =comment=bbb =address=192.168.1.39/24 =network=192.168.1.0 =broadcast=192.168.1.255
=interface=ether1
<STR>!done
<STR>
Here is a correct example, and we can see the reply to the command. In this example we have two replies, and there
is a tag <STR>that is used to show where is the end of a line. Each <STR> close a single reply. The command
ever ends with a <STR> describing an empty reply.
$ ./mik 192.168.1.39 admin "" -c /ip/dns/set#=primary-dns=99.99.99.99 0 Ok !done
<STR>
$ ./mik 192.168.1.39 admin "" -c /ip/dns/print 0 Ok !re =primary-dns=99.99.99.99 =secondary-dns=62.94.0.2
=allow-remote-requests=false =max-udp-packet-size=512 =cache-size=2048 =cache-max-ttl=1w00:00:00
=cache-used=5
<STR>!done
<STR>
Now i used a command that has some parameter. For example im changing the primary-dns of the board, and then i
print the new DNS configuration. The first command is a multirow. To write it on a single row under ms.dos we
need to user the # character to signal the end of the line. Under linux, its a good thing to use the quotation marks
around the last parameter.
The mikutility is written as a demo for the library MkApi.
An important note: The specification of the API mikrotik defines the command in a format that is slightly different
than the ones used from the telnet interface. The ID of the network addresses, and in general of the objects given