How to send this command to the router using API
/interface wireless access-list remove [find comment=teste]
Thanks
How to send this command to the router using API
/interface wireless access-list remove [find comment=teste]
Thanks
first, you should get .id’s of that entry:
/interface/wireless/access-list/print
.proplist=.id
?comment=teste
then remove all items found
/interface/wireless/access-list/remove
=.id=<your_id_here>
and, AFAIR, you may use comma-separated list of ids in <your_id_here>
I need dynamically as:
/interface/wireless/access-list/remove=
.id=</interface/wireless/access-list/print
.proplist=.id
?comment=teste>
is possible ?
no, first you have to getall items
do you ask, whether it’s possible to join API queries? no, it’s not. simply execute one query, then use its result for the second one. what’s problem?
HI,
I Understan all to remove, what I dont understand is when you say <your_id_here>
/interface/wireless/access-list/print
.proplist=.id
?comment=teste ******* isnot ?=comment=teste
/interface/wireless/access-list/remove
=.id=<your_id_here> ****What mean <your_id_here> What exactly Do I have to put
Thanks
first, you execute
/interface/wireless/access-list/print
=.proplist=.id
?comment=teste
“?comment=teste” is short form of “?=comment=teste”
in response, you receive something like
!re=
=.id=*4EB
and then you can delete this entry:
/interface/wireless/access-list/remove
=.id=*4EB
is it clear enough?..
can you please write the complete code?
complete code of what? it was already done in my prevoius post, no? =)
Hi, im new in this forum. Sorry my English ![]()
I have try make this example code to start learn Mikrotik API and I get de fallow message:
Connected...
<<< [22] /ip/hotspot/user/print
<<< [14] =.proplist=.id
<<< [14] ?comment=teste
>>> [5/5 bytes read.
>>> [5, 32] !trap
>>> [23/23 bytes read.
>>> [23, 8] =message=argument error
>>> [5/5 bytes read.
>>> [5, 1] !done
<br />
<b>Notice</b>: Undefined offset: 0 in <b>C:\wamp\www\api\teste2.php</b> on line <b>17</b><br />
testefsfs<<< [20] /ip/hotspot/user/set
<<< [5] =.id=
<<< [13] =disabled=yes
>>> [5/5 bytes read.
>>> [5, 1] !done
Disconnected...
My Code:
if ($API->connect('xxx', 'xxx', 'xxx')) {
$API->write('/ip/hotspot/user/print',false);
$API->write('=.proplist=.id',false);
$API->write('?comment=teste');
$A = $API->read();
$A = $A[0];
echo "testefsfs".$A;
$API->write('/ip/hotspot/user/set',false);
$API->write('=.id='.$A['.id'],false);
$API->write('=disabled=yes');
$API->read();
$API->disconnect();
Thanks!!
what version of RouterOS?
v3.13
queries (starting with ‘?’) appeared only in the v3.21. not sure about ‘.proplist’. so you should upgrade
Thanks Chupaka
So I need update de Router O.S. I,m afraid to do this becouse my server is run 100% whit this version 3.13.
May be I have to try a Telnet commands on my APP and forget mikrotik API ![]()
Thanks
update it. if something goes wrong, you can downgrade to 3.13 again =)
I will Take courage. Just in that RB I have up to 200 users lol
Maybe buy a less expensive RB411 just for test. Yes, in Brazil every think is too expensive lol
I have a router with up to 600 online users - I update it at night ![]()
Is possible take a same result with Telnet or SSH and PHP?
/ip hotspot user set [find comment="teste"] disabled=yes
is there any visual basic 6 class for mikrotik API? or sample maybe?
@chupaka => would you mind give some example using visual basic 6 to build a class for mikrotik API?
is it possible communicate to router API port (8728) using winsock control in visual basic 6
thanks