Some exclusive api's command

Hello all,

i am new using in api. i read wiki also but can’t get any help from that.

i added users successfully from the api in hotspot but i can’t disable a user from api.
i am executing $API->comm(“/ip/hotspot/user/disable/mani”);
this command but it shows Array ( [!trap] => Array ( [0] => Array ( [message] => no such command ) ) )

Please tell me exact command and please also tell me how i can change password of a hotspot user from api.

“/ip/hotspot/user/disable/mani” there is no such command

to disable
/ip/hotspot/user/disable
=.id=

can you please tell me full command. where i can write username of hotspot user. can you please tell me.

and “mani” is username i want to disable. so please tell me full command and please also tell me about updating of password of the user from api.

waiting for answer

anyone can please send me command… waiting for answer.

waiting for disable user complete command via API. anyone please send.

/ip/hotspot/user/print
?name=mani
=.proplist=.id

Command above will return an ID.
put that in command below.

/ip/hotspot/user/disable
=.id=

i will do this and update you shortly.
thanks for reply.

Hello,

i used that command but not disable a user. My user id is 31. my code is this please check and if an error then please tell me about that

  
  <?php

require('routeros_api.class.php');

$API = new routeros_api();

$API->debug = false;

if ($API->connect('10.53.51.123', 'admin', 'admin213')) {
	
   $API->write('/ip/hotspot/user/disable');
   $API->write('=.id=31');
   

print_r($ARRAY);
   $API->disconnect();

}

?>

First generate the ID via print, then use it.

Not to be mean, but the first reply in this thread told you that.

  • 31 is not a valid internal id . Internal ids always start with *.

is this command right for printing id

  <?php

require('routeros_api.class.php');

$API = new routeros_api();

$API->debug = false;

if ($API->connect('10.5.50.1', 'admin', 'adm44')) {
	
   $API->write('/ip/hotspot/user/print');
   $API->write('?name=mani');
   $API->write('=.proplist=.id');
   

print_r($ARRAY);
   $API->disconnect();

}

?>

???

can not getting any output from the above command. please tell me if anything wrong in the above command.

With this command password of user mani is changing work fine but according to your command DISABLE of USER is not working.

  <?php

$myusername = "mani";
$newpassword= "234";

require('routeros_api.class.php');

$API = new routeros_api();

$API->debug = false;


if ($API->connect('10.5.50.1', 'admin', 'ad4455')) {

   echo "Password Changed successfully!";

   $API->write('/ip/hotspot/user/set',false);
   $API->write('=.id=*21',false);
   $API->write('=password='.$newpassword);

   $READ = $API->read(false);
   $ARRAY = $API->parse_response($READ);
   
   $API->disconnect();

}
?>

Please tell me correct disable of user command.

Thanks and waiting

waiting…
for disable command…

you are very close to the solution! still trying
I recommend posting in the section corresponding “RouterOS Community Support [Scripting]”
programmers are more in this section and will likely receive more aid

Thanks for moving my post.

i know i am very close.. but no answer still founded on my post.

either you have syntax error in commands or there are problems with your php api.

As I mentioned commads (tested and working) and output are:

/ip/hotspot/user/print
?name=lala
=.proplist=.id

!re
=.id=*1
!done

/ip/hotspot/user/remove
=.id=*1