2

I use a Mikrotik API, i can use add Command but I do not know how can use remove command.

example Adding VPN user:

$API->comm("/ppp/secret/add", array(
          "name"     => "user",
          "password" => "pass",
          "remote-address" => "172.16.1.10",
          "comment"  => "{new VPN user}",
          "service"  => "pptp",
));

Now how can Remove example VPN User1?

http://wiki.mikrotik.com/wiki/Category:API

NetVicious
  • 3,848
  • 1
  • 33
  • 47
Amirreza
  • 61
  • 3
  • 8

2 Answers2

3
 $API->write('/ppp/secret/print', false);
 $API->write('?name=user', false);
 $API->write('=.proplist=.id');
 $ARRAYS = $API->read();


 $API->write('/ppp/secret/remove', false);
 $API->write('=.id=' . $ARRAYS[0]['.id']);
 $READ = $API->read();
Omid Kosari
  • 287
  • 5
  • 16
0

In mikrotik os terminal you can use remove like this:

  • remove [find name=NAME]
  • now test it in API
j0k
  • 22,600
  • 28
  • 79
  • 90
Mohsen
  • 25
  • 2