Community discussions

 
User avatar
janisk
MikroTik Support
MikroTik Support
Topic Author
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

API Links

Thu Jan 15, 2009 12:54 pm

API implementations in different programming languages from users of this forum:

in Perl - forum thread by cheesegrits
in Delphi - forum thread and wiki by rodolfo
in Delphi #2 - forum thread by Chupaka
in PHP - wiki link by Denis Basta
in PHP - wiki link by Ayufan
Java sample methods - forum post
in Python - wiki link by Mikrotik staff
in C# - wiki link by wiki user Gregy
Ruby on rails wiki and discussion on forum(v1.9) - by astounding
in Adobe Flash - wiki by haakon
in C - wiki by webasdf
in C (GPL2 license) -wiki by octo
.NET (C#) discussion on forum - external by danikf
in NodeJS - by trakkasure

API related information links:
http://wiki.mikrotik.com/wiki/API
http://wiki.mikrotik.com/wiki/API_command_notes
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 23993
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: API examples

Thu Jan 15, 2009 1:01 pm

it would be great if all of them would be in the wiki. the owners would also get RouterOS licenses!
No answer to your question? How to write posts
 
rodolfo
Long time Member
Long time Member
Posts: 539
Joined: Sat Jul 05, 2008 11:50 am

Re: API examples

Sun Jan 18, 2009 1:09 pm

rodolfo
IZ0UQV
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 23993
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: API examples

Mon Jan 19, 2009 8:57 am

cool! email support to get your RouterOS license
No answer to your question? How to write posts
 
rodolfo
Long time Member
Long time Member
Posts: 539
Joined: Sat Jul 05, 2008 11:50 am

Re: API examples

Wed Jan 21, 2009 2:07 pm

Thanks a lot!
rodolfo
IZ0UQV
 
haakon
just joined
Posts: 19
Joined: Sat May 02, 2009 6:02 pm

Re: API examples

Sat May 02, 2009 11:08 pm

Hi,

I've just made, and published Adobe Flash ActionScript 3 class for RouterOS API

http://wiki.mikrotik.com/wiki/API_ActionScript_3_class
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8273
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API examples

Mon May 04, 2009 8:55 pm

Janis, please add link to my topic =)

http://forum.mikrotik.com/viewtopic.php?f=9&t=31555
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 23993
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: API examples

Tue May 05, 2009 8:55 am

No answer to your question? How to write posts
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8273
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API examples

Tue May 05, 2009 12:58 pm

thanks, Normis. and add the Wiki, please =)

http://wiki.mikrotik.com/wiki/API_Delphi_Client
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
User avatar
DogHead
Member Candidate
Member Candidate
Posts: 194
Joined: Thu Jan 03, 2008 9:36 pm
Location: Anywhere you want me to be

Re: API examples

Wed May 27, 2009 1:06 am

The examples, etc using the API are great. We are already trying to write our own simplified interface for end users in Delphi based on the examples provided, but it is a major pain for us to learn Delphi (java, ruby or any other programming language for that matter). Even python is tough if you want to make a GUI and are not a programmer.

Before we spend a lot of time re doing what someone else has already accomplished (TowNet, Mikrocontrol, etc), I was wondering if there is someone who already has developed an open, simple windows client, like winbox, but designed for end users so they can simply specify a few parameters without having to understand the entire RouterOS. Source code? We are looking for a complete example that could be easily tweaked.

Webbox is close to what we want, but since you cannot change it's functionality, it is not going to do what we need.

With the introduction of LUA in v4, will we be able to port something like Gargoyle or LUCI onto RouterOS? This would be an interface that is customizable by us mere mortals (ISP guys with limited programming skills). LUA is close enough to simple scripting that we can figure it out and customize it ourselves. Of course you would need to be able to upload the LUA pages to a web server on the device in order for this to work.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8273
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API examples

Wed May 27, 2009 1:19 am

We are already trying to write our own simplified interface for end users
what functionality do you need?
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
User avatar
DogHead
Member Candidate
Member Candidate
Posts: 194
Joined: Thu Jan 03, 2008 9:36 pm
Location: Anywhere you want me to be

Re: API examples

Wed May 27, 2009 1:54 am

We would want to be able to:

1. Add/enable bridge or mesh interface
a. Bond interfaces into bridge or mesh
b. For bridge turn on or off RTSP
c. For mesh make portal node
2. Configure wireless
a. Set mode, band, frequency, SSID
b. Enable Nstreme
c. Enable WPA and set PSK
3. IP/Routing/NAT
a. Apply IP address and mask to interface
b. Enable NAT and set public interface
c. Set up port forwarding
d. Enable DMZ (one host for port forwarding) and set address
e. Set default gateway
f. Add/delete static routes
4. DHCP
a. Enable server on interface with range, default gw, and dns server
b. Enable client on interface
5. Administration
a. Set password
b. Set system ID
c. Set time zone and time
d. Enable and set NTP

All values would populate from the running configuration of the router. Apply would change only values that were altered. The rest of the detailed set up would be done via winbox or telnet by an administrator. If there were even more configuration available, but we had the option of editing the source to delete out the functions we don't need for a particular type of user, it would be really cool. Maybe the ability to reset and run a script would be good. Still thinking about it.

This is the kind of application I think a lot of people want, but none of us has either the programming skill or the money to pay for development. Once an example is made, I bet you would have all sorts of variants. Your API test interface was good, but didn't really go far enough in showing how edits would work, etc.

Any help on this would be really appreciated.

Would look something like the attached:
You do not have the required permissions to view the files attached to this post.
 
User avatar
cholegm
Frequent Visitor
Frequent Visitor
Posts: 56
Joined: Thu Jul 19, 2007 7:43 pm
Location: Gornji Milanovac, Serbia
Contact:

Re: API examples

Thu May 28, 2009 11:43 am

Can anybody make the API for VB (for VB projects and ASP pages)?!



Thanks,
Mladen
Ako nešto ne znaš da uradiš... Obrati se onom ko zna... Da ne zajebes nešto...
 
ayufan
Member
Member
Posts: 331
Joined: Sun Jun 03, 2007 9:35 pm
Contact:

Re: API examples

Tue Jun 23, 2009 4:05 pm

Use C# code ;)
hAP AC, TP-Link Archer C7 v2, RB951G, RB450G, RPI2, RPI zero
 
User avatar
tgrand
Long time Member
Long time Member
Posts: 671
Joined: Mon Aug 21, 2006 2:57 am
Location: Winnipeg, Manitoba, Canada

Re: API examples

Mon Jul 27, 2009 10:59 pm

There is a vb.net sample on the forums.
Do a search
 
hgmamaci
just joined
Posts: 6
Joined: Wed Jul 15, 2009 9:14 pm

Re: API examples

Fri Aug 14, 2009 11:57 am

We would want to be able to:
Could you find anything on this? Can you please share if you had.

Thanks
 
User avatar
DogHead
Member Candidate
Member Candidate
Posts: 194
Joined: Thu Jan 03, 2008 9:36 pm
Location: Anywhere you want me to be

Re: API examples

Fri Aug 21, 2009 9:00 am

No word from anyone on this.

We would love to see someone come up with a good working solution.
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

Re: API examples

Tue Oct 13, 2009 6:23 am

I'm working on an API client in C at the moment (for implementation in an openWRT metarouter). Has this been done yet? I don't want to re-invent the wheel, especially since my C is really rusty.

So many seg faults so little time :)
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5886
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: API examples

Tue Oct 13, 2009 8:04 am

http://wiki.mikrotik.com/wiki/MUM_2009_CZ
Look for API SDK by Townet, Italy
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8273
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API examples

Tue Oct 13, 2009 2:19 pm

DogHead, you have nice screenshot - what's problem? you now just need a bit of coding =) can you share that form? p.s. is it Delphi?
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

Re: API examples

Tue Oct 13, 2009 3:41 pm

I did previously find API SDK by Townet, Italy, but they only published object files and headers. I need source code in order to cross compile for openWrt in MetaRouter. BTW, I will post it when I get it finished.
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

Re: API examples

Thu Oct 15, 2009 1:35 am

C implementation of the API attached. If anybody wants to check my work, comments are welcome.

Enjoy!
You do not have the required permissions to view the files attached to this post.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Topic Author
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: API examples

Thu Oct 15, 2009 11:53 am

webasdf, thank you for your addition.

code is clearly written and easy to read.

If you could make wiki article with your source and some explanation you could even get some benefits. you can read that in this post by normis
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

Re: API examples

Thu Oct 29, 2009 6:22 pm

webasdf, thank you for your addition.

code is clearly written and easy to read.

If you could make wiki article with your source and some explanation you could even get some benefits. you can read that in this post by normis
Silly question. I went to start an article on the wiki about my C implementation of the API. I can't find the sign-up page to create an account on the wiki site. I have several important changes to make to my implementation and want to get them documented. Is there a signup page or do I need to e-mail someone about creating an account on the wiki?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8273
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API examples

Fri Oct 30, 2009 1:51 am

yeah, the registration of new accounts is blocked:
Permissions Errors

You do not have permission to create this user account, for the following reason:

The action you have requested is limited to users in the group: Administrators.
who broke the Wiki? ))
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 23993
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: API examples

Fri Oct 30, 2009 9:50 am

why do you need another account?

wiki registration was temporatily blocked because of spam attacks, we will try to solve it, and turn it on later today
No answer to your question? How to write posts
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8273
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API examples

Fri Oct 30, 2009 2:38 pm

webasdf needs his first account - and cannot register %)
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 23993
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: API examples

Fri Oct 30, 2009 2:45 pm

OK I will turn on registration now
No answer to your question? How to write posts
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

Re: API examples

Fri Oct 30, 2009 3:07 pm

OK I will turn on registration now
Thanks for opening registration on the wiki. I was able to make an account.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 23993
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: API examples

Fri Oct 30, 2009 3:15 pm

does anyone know any better spam protection plugins for mediawiki ;) ? REcaptcha is not stopping them anymore.
No answer to your question? How to write posts
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

Re: API examples

Sat Oct 31, 2009 4:25 pm

does anyone know any better spam protection plugins for mediawiki ;) ? REcaptcha is not stopping them anymore.
I manage a PHPBB forum sometimes. On our registration form, we have CAPTCHA as well as a basic question, "What color is the sky?" I read somewhere that simple questions like that can fool most spambots. If you can add a simple mandatory field (so that you can't register w/o selecting the right answer) on your reg form like that, it may work for you. It seems to have worked for us.
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

Re: API examples

Mon Nov 02, 2009 5:58 am

webasdf, thank you for your addition.

code is clearly written and easy to read.

If you could make wiki article with your source and some explanation you could even get some benefits. you can read that in this post by normis
Made some modifications to my C implementation. It has been successfully tested with 1, 2 and 3-byte encoded length fields (the logic should also work w/ 4-byte lengths). Also supports little endian AND big endian CPU architectures. Here's a link. API in C Wiki Article
 
User avatar
janisk
MikroTik Support
MikroTik Support
Topic Author
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: API examples

Mon Nov 02, 2009 9:18 am

nice article webasdf, please write to support@mikrotik.com so we can give you well earned RouterOS license.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Topic Author
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: API examples

Mon Nov 30, 2009 12:47 pm

we have 2 new additions from ayfan in PHP and Octo in C
 
xezen
Long time Member
Long time Member
Posts: 628
Joined: Fri May 30, 2008 10:23 am
Location: South Africa

Re: API examples

Tue Dec 01, 2009 7:27 am

im new to api and codeing and looking for advice

i think php would work for me

what i am trying to get is read the gps connected to the serial port of a mikrotik

so i will have a gsp connected to serial and my api will read it!

put i cant seem to get the gps data up can some one point me to the line were i call the gpsdata up please
If i dont No Ask someone That Does!
 
User avatar
janisk
MikroTik Support
MikroTik Support
Topic Author
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: API examples

Tue Dec 01, 2009 9:03 am

are you able to read that information in console? with what command?
 
xezen
Long time Member
Long time Member
Posts: 628
Joined: Fri May 30, 2008 10:23 am
Location: South Africa

Re: API examples

Tue Dec 01, 2009 3:04 pm

i have a a gsp connected to console and on the routerboard i set remoter accesson a port
to connect to the serial

example

gps-----serail on routerboard-------wireless

on the routerboard i set a remote to seial connection

so i get this
x.x.x.x:5000

in internet explore


if i type in x.x.x.x:5000 it shows me a webpage with all datat comming off the gps

then with my oracle database i read and store the data


then i use geoserver and oracle and google earth to give me my live gps feeds as long as my wireless stays up

took some time to get this setup running
If i dont No Ask someone That Does!
 
csickles
Forum Guru
Forum Guru
Posts: 1257
Joined: Fri May 28, 2004 8:46 pm
Location: Phoenix, AZ
Contact:

Re: API Links

Fri Sep 10, 2010 7:39 pm

Cool.............

I just snagged a copy of the C# code and compiled it into a DLL...

For those like me who dont do C#, but do VB,,

Here is a DLL (It is un-altered from the WIKI (Except a referance to system.socket))

Reference it in Your VB project like so...

    Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
        Dim sStatus As String = ""
        Dim MTK As New MikroTikAPI.MK("10.0.0.3")

        Me.rtInfo.Text = ""
        If MTK.Login("Your-UserID-Here", "Your-Password-Here") Then

            MTK.Send("/ip/address/print")
            'MTK.Send("/ping")
            'MTK.Send("=address=10.0.0.1")
            'MTK.Send("=count=1")
            'MTK.Send("/interface/wireless/registration-table/print")
            MTK.Send(".tag=sss", True)

            For Each sStatus In MTK.Read
                Me.rtInfo.Text = Me.rtInfo.Text + vbCr + sStatus
            Next
        Else
            Me.rtInfo.Text = "Login Error. Correct User / Password"
        End If
        MTK = Nothing
        sStatus = Nothing
    End Sub

This will get you started..

Remember that the return is sent back as a list object, so you need to cycle thru it as in the above example..

The Tags statement will need to be dealt with.. I havent had time to study it's function Etc...

Off I go to play with the New MikroTik API object.. Lets see how long it takes me to brick a router.... :lol:
You do not have the required permissions to view the files attached to this post.
Things that make you go "Hmmmmmmmm"...

Craig
 
User avatar
janisk
MikroTik Support
MikroTik Support
Topic Author
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: API Links

Mon Sep 13, 2010 2:04 pm

good.

and what about .tag?

it is there to identify reply from command and will contain same tag set as you set it sending command to RouterOS.
 
csickles
Forum Guru
Forum Guru
Posts: 1257
Joined: Fri May 28, 2004 8:46 pm
Location: Phoenix, AZ
Contact:

Re: API Links

Tue Sep 14, 2010 1:13 am

Ok, I think I got it.

So if I send a tag of "MyTag" then the reply contains the same text in the reply "tag"?

I will give it a try...

Thx..
Things that make you go "Hmmmmmmmm"...

Craig
 
csickles
Forum Guru
Forum Guru
Posts: 1257
Joined: Fri May 28, 2004 8:46 pm
Location: Phoenix, AZ
Contact:

Re: API Links

Tue Sep 14, 2010 1:20 am

K...

Makes sence now..

the ".tag=MyTag" shows the "command sender IE: who issues the command so that the reply can be verified.


Cool... More to come...
Things that make you go "Hmmmmmmmm"...

Craig
 
csickles
Forum Guru
Forum Guru
Posts: 1257
Joined: Fri May 28, 2004 8:46 pm
Location: Phoenix, AZ
Contact:

Re: API Links

Tue Sep 14, 2010 1:25 am

So I have the cool use of the day...

You have a email scanner of web filter, and it detects that traffic from one IP or a range if IPs is just garbage.. IE viruses or boat loads of SPAM..

Then you could (Via API) add the IP/s to an IP list and then use firewalling to drop all IPs on that list..

With scripting Etc (Or the device adding the offending IP/s to the list) the system admin(s) could be notified by email Etc..

COOL !!!
Things that make you go "Hmmmmmmmm"...

Craig
 
User avatar
janisk
MikroTik Support
MikroTik Support
Topic Author
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: API Links

Thu Sep 16, 2010 10:46 am

in case of viruses that is good solution in case of mail - no normal user needs to make SMTP connection more than once in a second or in a few seconds, so, if you can add just rate limiting smtp connections, or add to blacklist allowing 1 connection every 30 seconds or ban altogether.

That can be done this way because users when send e-mail with many recipients, they send one message.
 
csickles
Forum Guru
Forum Guru
Posts: 1257
Joined: Fri May 28, 2004 8:46 pm
Location: Phoenix, AZ
Contact:

Re: API Links

Thu Sep 16, 2010 8:51 pm

For smaller users this is true...

For us Old timmers that have Mail server records in the 10s of thousands. (Spammers NEVER delete an address they figure out)
(We were 6500 users on the average at any one time (IT staff = 340) over the years) turn over for over 25 Years...

Our avarage SPAM load is 250 to 350 SPAMS per user per day.
Multiply that by 15K users, and more and more payloads are to one or two persons at a time (to avoid list SPAM rules (Bots send so who cares about sender CPU loads))..

My Avg. SPAM load is 99.98% bad at the mail gateway. (99.8 % to people that DONT EXIST ! LDAP takes a BEETING !!)

It requires 3 seporate scanning systems (Layered) (One with 8 AV engines) just to "TAME" it down...

So blocking spammers at the router (IP based) is a GOOD thing...

Mabee my filtering systems can stop SMOKING !!!

And as far as connection rates..

Microsoft "rates" user / system connection rates... Mine even with the filters rates as "Obcene"..

I have had comment from Microsoft SEs "And it is still running ?".. I say no more..
Things that make you go "Hmmmmmmmm"...

Craig
 
Ripper
Member Candidate
Member Candidate
Posts: 132
Joined: Thu Aug 05, 2010 1:24 am

Re: API Links

Sat Sep 18, 2010 2:30 am

how execute command in PHP API
 queue simple disable P40-34-9-2 
i've tryed that way

$API->write('/queue/simple',false);
$API->write('=disable=P40-34-9-2');

but it sad unknow command

any solution ?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8273
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API Links

Sun Sep 19, 2010 3:44 am

try

$API->write('/queue/simple/disable',false);
$API->write('=.id=P40-34-9-2');
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
Ripper
Member Candidate
Member Candidate
Posts: 132
Joined: Thu Aug 05, 2010 1:24 am

Re: API Links

Sun Sep 19, 2010 1:18 pm

Thanks a lot that was useful.
 
Phalanx00
just joined
Posts: 17
Joined: Wed Jan 19, 2011 9:45 am

Re: API Links

Sun Feb 13, 2011 9:54 am

I have a stupid question on http://wiki.mikrotik.com/wiki/API_In_CPP:
I need to send 4 commands, but only first one will execute.
login...
// first command
            writeSentence.AddWord("/export");
            writeSentence.AddWord("=file=script");
            
            mt.WriteSentence(writeSentence);
            mt.ReadBlock(block);

// second command
            writeSentence.AddWord("/file/set");
            writeSentence.AddWord("=numbers=script.rsc");
            writeSentence.AddWord("=contents=\"" + Commands + "\"");
  
            mt.WriteSentence(writeSentence);
            mt.ReadBlock(block);
 
So I tried wait for !done
bool done = 0;
while (!done) {
                mt.ReadSentence(readSentence);

                if (readSentence.GetSentence() == "!done" ) {
                    done = 1;
                }
}
But I have right debug output and still only first command will be executed. All of commands worked alone nice. This is the last thing what I need to finish my hell project :D Thank you for anything usefull
 
User avatar
janisk
MikroTik Support
MikroTik Support
Topic Author
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: API Links

Tue Feb 15, 2011 3:23 pm

It looks correct at first glance at what you posted, with what commands i have tested.

You could try to sniff traffic and see what sniff contains, if there are replies from router and what they contain.

if completely unsure, you can try with python example and see if these commands actually work.
 
Phalanx00
just joined
Posts: 17
Joined: Wed Jan 19, 2011 9:45 am

Re: API Links

Wed Feb 16, 2011 6:31 pm

There's something weird in CPP API.

my app is these four commands:
1) create file
2) edit file
3) import file
4) remove file

In Qt/C++ I have this behavior:
1) if file was not created, only file is created (step 1)
2) if file was created, it runs correctly

If anybody could try it, I wrote small client program with clean C++ API solution. Same behavior unless if file was created, import is trap...
I post cpp api if you can try that.

edit client.cpp with your information in call API Login then
make
./client

Hope it helps others too :?

EDIT: WORKS if use standart exporting, no ip address exporting
writeSentence.AddWord("/export");
writeSentence.AddWord("=file=script");
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: No registered users and 4 guests