Mikrotik API remove command

10.1k Views Asked by At

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

2

There are 2 best solutions below

0
On
 $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();
0
On

In mikrotik os terminal you can use remove like this:

  • remove [find name=NAME]
  • now test it in API