I am trying to use the API to update user-manager user details. From what has been posted elsewhere on this forum, my understanding is that in order to read the contents or update the record for one user I have to:
- issue a “/tool/user-manager/user/find” command
Parse the returned data and then for each ID returned…
issue a “/tool/user-manager/user/get =.id=ID” for each one looking for the record ID for the record where “name=USERtoBEupdated”
issue a "/tool/user-manager/user/set =.id=ID =add-credit=CREDIT
Given that there may well be several thousand users in the database, I have to get the values of (on average) half of them before I find the ID of the record I want to access.
This can’t be right - it just doesn’t make sense to shift all that data over a network link when it could be done with one command.
So… on a whim I tried “/tool/user-manager/user/get =.id=USERNAME” and, whaddaya know, it worked!!
I clearly do misunderstand how the API works, but I can’t seem to find any clear documentation - the page at http://wiki.mikrotik.com/wiki/API is lacking a lot of information.
The questions are therefore:
- Is there an API manual?
Is the method of ‘=.id=USERNAME’ valid or should I not rely on it working?
Thanks,
Nick.