It’s my API client realization for Delphi7. It implements execution of parallel queries which are easily handled due to database-like interface.
v1.3: Added support for RouterOS 6.43+ API login method
v1.2: Added basic support for API over TLS
v1.1: Added Delphi 2009 compatibility (thanks to Anton Ekermans for testing)
I am searching some one there can help developing an api to the routeros.
Would you contact me at dev (at) sealink dot dk
The final result should make a communication from a web portal interface to the routerboard for activating predefined scripts on the routerboard ex. could be
The interface, API and scripts will give a user ex. in the reception of a hotel a https page where he can login. On this page the hotel have all network plugs for meeting rooms.
The user pick a room “center stage east” and choose 6 hours from the drop down menu and a few other parameters like which bandwidth there are required.
When he click execute button then it should establish a connection by the API to the routeros and execute a script which is on the routerboard.
For further details about your consulting please contact me.
Chupaka,
very good work with “RouterOSAPI.pas” I am a doubt, because not found any procedure in the engine ROSAPI for when the connection to incorrectly, you already did something for this case?? to be clearer for example when Winbox this running and for some reason it loses connectivity to the server then it terminates the application, I am trying to do that! you can help me?
very good work with “RouterOSAPI.pas” I have some doubts, because not found in any procedure for ROSAPI engine stoped when the connection incorrectly, you already did something for this case?? to be clearer for example when Winbox this running and for some reason it loses connectivity to the server then it terminates the application, I am trying to do that! you can help me?
I’ve been developing some very nice stuff with ROS to read info from my ±200 RBs, it’s really great!
But I have a question:
How do I set a value using ROSAPI? e.g. i can read ‘hw-protection-mode’ by:
Res := ROS.Query([‘/interface/wireless/print’], True);
if not Res.Trap
then begin
ShowMessage(Res[‘hw-protection-mode’]);
end;
but how do I set the value to e.g. ‘hw-protection-mode=rts-cts’ ?
To Chupaka:
Im trying do develop something similar in C# using the help from http://wiki.mikrotik.com/wiki/API_in_C_Sharp, but I have some problems concerning sending the requests:
I run the application, Login forms po-pup - input login,passwd, connect successfully, main application window is open.
And now if I want to execute(send) certain commands to the router I use the same function,which was used to create connection at the beginning but without login function. But then I get response from router about !fatalogin.
Is it necessary to use login and passwd, set at the beginning, to execute(send) each command sentence to the router? How do you do it?
Maybe I’m doing the whole thing wrong, but I thought it could work.
PS:I don’t work with Delphi at all so your code does not really help me.
You shouldn’t need to send the login info with each request, as long as you maintain (keep open) the same session/conection.
Once the session is authenticated, it should work on the same session.
Maybe you can generate an exact log of what you send/receive and post it here, that might be easier to see what’s wrong as C code would not make any sense to a Delphi-only programmer like me either. (Or at least compare the log with the API wiki)
anyway, if we see what output you have, we could say where is the problem.
And as previously said - basic steps are - make tcp/ip connection, authenticate w/ /login, send commands, close connection.
now every part in bit more detail
making of connection - easy part, simple connection
/login part - you have to follow the procedure carefully, getting challenge, forming reply and getting positive reply that you are in
sending commands - on each command you send you will get reply. if you use several commands that will run for some time (/ping, something with =follow=) use .tag, to tag replies
I already got to the point 3 where I can send comands without problems(but only one at the same time) except these two: /interface/monitor-traffic
/interface/wireless/scan
the first one works only with argumnent once.
is sth like once also by the scan?
I will be probably sending more request at the same time( for example I will monitor bandwidth and I will also want to get info about some interface..), so you think just to tag the reqest is enough? Because I was thinking about threading, where especially those commands like monitor,scan etc will be send through one of these threads.