Get token via api


#1

I’m trying to add users from a rails app. When I add them, I would like to get the auth token (to pull the dashboard on user specific sites) and save it to the user in my local db. Is it possible to do this remotely if the app itself runs as the superuser? I would prefer to automate this step to avoid have each user to sign in to piwik manually and enter the token manually for storage.

Any help is much appreciated!


#2

Yes. If you know the superadmin token, you can do request like:


index.php?module=API&method=UsersManager.getUser&userLogin=foo&format=JSON&token_auth=bar

where userLogin - required user login;
token_auth - token of the user with superuser access.


#3

Awesome, thanks!