The download contain the source code of a Delphi class (and of a demo application) to simply interface the routerOS API.
Please refer to http://wiki.mikrotik.com/wiki/API_Delphi for more informations.
LAST VERSION api_studio_108.zip (497 KB)
Please report me suggestions, errors and so on.
the included compiled EXE does work OK here. Compiling the source with Delphi 6 works (after hacking in a replacement for PosEx, which is not there in Delphi 6), but the tool hangs during opening the connection to the router. Actually it stalls in tr_mkrouter.open while waiting for the response for the first “/login” command. That’s in this line:
Nevermind. Seems to be a bug with the version of the synapse library contained in your download.
I checked out the latest revision from SVN (rev. 95) and it started working right away
i have tried this software its great, i would like to know why it doesnt handle streaming data from the router,
for example: i am trying this command /tool ping 192.168.100.1
one time i get this:
14/01/2009 05.21.50 - 142 -
14/01/2009 05.21.50 - info 102 - EXECUTE= /tool ping 192.168.100.1
14/01/2009 05.21.50 - info 103 - =!done=
and the other time i get this (why?) :
14/01/2009 05.23.57 - 142 -
14/01/2009 05.23.57 - info 102 - EXECUTE= /tool ping 192.168.100.1
14/01/2009 05.23.57 - #ERROR# 10004 - 192.168.100.1 tr_mkrouter.mrecv !trap==!trap=message=no such command=
14/01/2009 05.23.57 - info 103 - =!trap=message
=no such command=
if you try other example and sniff for actual API traffic you will notice that there is symbol in between the lines and your output of :
=!re=.id=*6=name=wan-adsl=mtu=1500=mac-address=00:41:05:4F:82:DA=arp=enabled=disable-running-check=yes=auto-negotiation=yes=full-duplex=yes=cable-settings=default=speed=100Mbps=running=yes=slave=no=comment==disabled=no==
as far as i can remember - each line have value preceding the line, that shows how many symbols there is in the line, hence, always it will be like =some-arg=value and value will be everything till the end of line after 2nd “=”
either fix that in the code or ask someone to do that for you
also, this class do not work correctly with replies, containing #0 in parameter value, because it is designed to think that #0 is the end of sentence. so, for example, I cannot get normal list of my DHCP server leases, where Agent-Circuit-ID is MAC address of switch and contains #0 in it
p.s. why is this implementation so slow?.. mine is based on Synapse too, and prints output much faster… I hope some day I will public it, I just began to code…
I am using the API to develop an control software as ‘Mini-winbox’, now i face an trouble with the api.
when i want to issuse the command like ‘/ip/router/unset .id=*2 routing-mark’ , i get get an argument error.
How to using unset command through RouterOS API?
I have ask this question 1 year before, but no body can answer me as well, Would u like to help me on this ? Thank u very much~!