So, I have the following function to activate a Profile for a registered user using the RouterOS php library
public function activateProfile($username)
{
$activationQuery = new Query(
'/tool/user-manager/user/create-and-activate-profile',
[
'=user=' . $username,
'=customer=admin',
'=profile=profile1',
]
);
$response = $this->query($activationQuery)->read(false);
print("Activating Profile...");
print_r($response);
}
But I keep getting the error message below
Activating Profile...Array ( [0] => !trap [1] => =message=no such command [2] => !done )
Quick Reply
You cannot pass attribute word
user
, you need to pass the number that identifies the user instead. Better to first create and then create-and-activate-profile as documentation says.Explanation
RouterOS APi command words closely follow CLI.
Your command word is
/tool/user-manager/user/create-and-activate-profile
.Your attributes words are
=user
,=customer
,=profile
.Yo can compare with CLI and wiki from User_Manager, =user= is available
Demostration