Community discussions

MUM Europe 2020
 
dveretennikov
just joined
Topic Author
Posts: 2
Joined: Wed Jan 15, 2020 3:47 pm

API enable\disable ip sec peer

Wed Jan 15, 2020 3:51 pm

Hi, could somebody help me with API ?
I need equivalent of cli command
/ip ipsec peer disable peer1

I use php
<?php

require './routeros_api.class.php';
$API = new RouterosAPI();
$API->debug = true;
if ($API->connect('1.1.1.1', 'api', 'api')) {

$API->comm("/ip/ipsec/peer/disable/peer1");
    $API->disconnect();
}
~


Connected...
<<< [33] /ip/ipsec/peer/disable/peer1
>>> [5/5] bytes read.
>>> [5, 33]!trap
>>> [24/24] bytes read.
>>> [24, 8]=message=no such command
>>> [5/5] bytes read.
>>> [5, 1]!done
Disconnected...
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5960
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: API enable\disable ip sec peer

Thu Jan 16, 2020 7:15 pm

Please read documentation on how to use API
https://wiki.mikrotik.com/wiki/Manual:A ... escription
 
dveretennikov
just joined
Topic Author
Posts: 2
Joined: Wed Jan 15, 2020 3:47 pm

Re: API enable\disable ip sec peer

Mon Jan 20, 2020 12:41 pm

Documentation is not so clear, that why I asked.
Finally it worked

<?php

require './routeros_api.class.php';
$API = new RouterosAPI();
$API->debug = true;
if ($API->connect('1.1.1.1', 'api', 'pass')) {

$API->comm("/ip/ipsec/peer/disable
=numbers=peer1");
$API->disconnect();
}

Who is online

Users browsing this forum: martinclaro and 7 guests