Page 1 of 1

Problem "add new user with profile" JAVA CODE

Posted: Sun Jan 31, 2016 9:38 am
by khaled11
Hello
I have coded a program in java to add user and profile - mikrotik 5.26- the user added but no Profile added
help PLZ
  this.ret.sendCommand("/tool/user-manager/user/add\n=name=" + Hotspot_User_Add.this.username + "\n=password=" + Hotspot_User_Add.this.password + "\n=customer=" + "admin");
                    Thread.sleep(500L);
                    this.ret.sendCommand("/tool/user-manager/user/create-and-activate-profile\n=profile=" + Hotspot_User_Add.this.profile_choosed + "\n=customer=" + "admin" + "\n=numbers=" + Hotspot_User_Add.this.username);
                    Thread.sleep(500L);
                    this.status = true;
                  }

Re: Problem "add new user with profile" JAVA CODE

Posted: Tue Feb 23, 2016 12:03 pm
by legrang
Don't use the example code from the wiki - it's difficult to use, requires intimate knowledge of the RouterOS API and doesn't really have error handling. Rather use this library: https://github.com/GideonLeGrange/mikrotik-java. If you follow the examples in the README, you'll hopefully get further.