Page 1 of 1

API MIkrotik

Posted: Thu Oct 26, 2017 12:45 pm
by adminradi
hello, i have probblem
how to remove actual profile use php api mikrotik. i have profile success to create and active profile for user in usermanager
but i not remove active profile..
tank's you for answer
How to script remove actual profile with php api mikrotik
Screenshot_31.png

Re: API MIkrotik

Posted: Tue Oct 31, 2017 1:30 am
by ahmedalmi
there is no script to do this . just by user manager web
but you can remove the user then add new with your new profile

Re: API MIkrotik

Posted: Tue Dec 05, 2017 8:25 am
by ADahi
via Script/CLI
suppose username is "111"
suppose profile is TRIAL

To remove user profiles try this
/tool user-manager user clear-profiles numbers=[find username="111"]; 


To add profile to user try this
/tool user-manager user create-and-activate-profile profile=TRIAL customer=admin numbers=[find username="111"]; 


Best Regards

Re: API MIkrotik

Posted: Sat Aug 03, 2019 12:26 am
by sirdash
via Script/CLI
suppose username is "111"
suppose profile is TRIAL

To remove user profiles try this
/tool user-manager user clear-profiles numbers=[find username="111"]; 


To add profile to user try this
/tool user-manager user create-and-activate-profile profile=TRIAL customer=admin numbers=[find username="111"]; 


Best Regards
hello
this work for me
but a question
i have 3 profile but i can active a profile for user . why?

Re: API MIkrotik

Posted: Wed Oct 09, 2019 2:02 pm
by yalozair
where is the problem
MK mikrotik = new MK(textBox1.Text, Convert.ToInt16(textBox8.Text));
if (mikrotik.Login(admin, password))
{

mikrotik.Send("/tool/user-manager/profile/print", true);

mikrotik.Send("=.username=name=");
mikrotik.Send("=.proplist=owner=");
mikrotik.Send("=.proplist=name-for-users=");
mikrotik.Send("=.proplist=validity=");
mikrotik.Send("=.proplist=starts-at=");
mikrotik.Send("=.proplist=price=");
mikrotik.Send("=.proplist=override-shared-users=");

mikrotik.Send(".tag=/tool",true);
string result = Convert.ToString(mikrotik.Read());
comboBox1.Items.Clear();

int a1,a2,a3,a4,a5,a6,a7;
foreach (string h in mikrotik.Read())
{

a1 = h.IndexOf("=name=");
a2 = h.IndexOf("=owner=");
a3 = h.IndexOf("=name-for-users=");
a4 = h.IndexOf("=validity=");
a5 = h.IndexOf("=starts-at=");
a6 = h.IndexOf("=price=");
a7 = h.IndexOf("=override-shared-users=");


if (a1 > 0 && a2>0 && a3>0 && a4>0 && a5>0 && a6>0 &&a7>0 )
{
comboBox1.Items.Add(h.Substring(a1));
}


}
}