Mikrotik API remove command

Amirreza picture Amirreza · Feb 1, 2012 · Viewed 9.1k times · Source

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

Answer

Omid Kosari picture Omid Kosari · Feb 3, 2013
 $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();