Is it possible to completely set up a Looker user via the API?

Knowledge Drop

Last tested: Aug 18, 2017
 

Creating a user with any kind of credential can be done in Looker, but there is usually another step that has to be done manually to get the user logged in and ready to go.

For example, to create a user with email credentials requires 2 api calls: create_user + create_user_credentials_email.

After this is done, the user account will have an email address associated with it, but the user account will not be active because it does not have a password associated with it.

You will need to call create_user_credentials_email_password_reset(user.id) to generate a password reset url, and then you will need to send that password reset url to the end user (perhaps via email) and instruct them to click the link to set their password securely on first login. The Looker API does not send that email.

Also, for brand new users, who are setting up their accounts for the first time, check out the last point at the end!

EXAMPLE CURL

POST to create new user:

curl -X POST \  

https://yourcompany.looker.com:19999/api/3.1/users \  

-H 'Authorization: token <access_token>' \  

-d '{  "first_name": "bryan",  "last_name": "is kewl"}'

POST to create a new email for them:

curl -X POST \  

https://yourcompany.looker.com:19999/api/3.1/users/1422/credentials_email \  

-H 'Authorization: token <access_token>' \  

-d '{"email": "bryan+iskewl@looker.com"}'

POST to get password reset link:

curl -X POST \  https://yourcompany.looker.com:19999/api/3.1/users/1422/credentials_email/password_reset \  

-H 'Authorization: token <access_token>'

For brand new users, who are creating their user account for the first time: take password reset link and run it by swapping out /password/reset/ with /account/setup/

This content is subject to limited support.                

Version history
Last update:
‎05-07-2021 09:48 AM
Updated by: