I'm building a WiFi authentication tool with user profile edit and guest credentials, etc.
I can write users to the mikrotik and remove users without an issue, but I can't find any documentation on editing the user profile. I suppose I could just remove it and add a new record, but that is just inefficient and may create issues with user keys down the line.
I'm using class.routeros_api.php and I'm on version 6.30
To add a user is done like so...
$response = $api->comm("/tool/user-manager/user/add",array(
"customer" => "admin",
"username" => "guest_user",
"location" => "Guest",
"first-name" => "Guest",
"last-name" => "1",
"password" => "somepw",
"shared-users" => "1",
"copy-from" => "00:00:00:00:00:00"
));
Deleting a user...
$response = $api->comm("/tool/user-manager/user/remove",array(
".id" => "*15"
));
so I figured editing a user would be something like...
$response = $api->comm("/tool/user-manager/user/edit",array(
".id" => "*15",
"username" => "someotheruser",
"password" => "someotherpass"
));
However, the error I'm receiving is...
<<< [28] /tool/user-manager/user/edit
<<< [8] =.id=*14
<<< [14] =username=someotheruser
<<< [19] =password=someotherpass
>>> [5/5] bytes read.
>>> [5, 35]!trap
>>> [26/26] bytes read.
>>> [26, 8]=message=unknown parameter
>>> [5/5] bytes read.
>>> [5, 1]!done
If someone has done this before and can assist with the appropriate syntax for the "/tool/user-manager/user/edit" command, it would be greatly appreciated.
So after some research into how this thing actually works, it appears I was just using the wrong command.
The correct way to edit a user on the mikrotik is to do the following...
$api->comm("/tool/user-manager/user/set",array(
".id" => "*14",
"username" => "somenewuser"
"password" => "somenewpassword",
));
In fact, "set" is the way you post edits for every feature. "edit" is for multi-line editing.
Special thanks to drew010 for the WinBox idea and the link to the commands wiki.