Add email information of a user via API

Solved!
Charly
Level 2
Add email information of a user via API

Hello all !

I'm currently creating new users in Dataiku with a project and Python code. I use https://doc.dataiku.com/dss/latest/python-api/client.html#dataikuapi.DSSClient.create_user

My problem is that I can't find how to add the mailing information via API. The argument isn't described in the page I linked earlier. Does someone know how I can fix this ?

Thank you and have a nice day ! ๐Ÿ˜ƒ

0 Kudos
1 Solution
HarizoR
Developer Advocate

Hi Charly,

Once you have created your user via the API, the create_user() methods returns a handle on the instanciated dataikuapi.dss.admin.DSSUser object. You will need to use this handle to edit the settings in order to add the emailing information, here is a simplified example:

import dataiku
client = dataiku.api_client()
# Here we create the user and retrieve a handle on it. If the user
# is already created, use get_user(user_id) instead.
user = client.create_user(login="bob42",
                          password="bob42",
                          display_name="Bob",
                          source_type="LOCAL",
                          profile="DATA_SCIENTIST")
settings = user.get_settings()
settings.get_raw()["email"] = "bob42@gmail.com"
settings.save()

 

Once this code is run, the "Email" field in the user account properties will be filled accordingly.

Best,

Harizo

 

View solution in original post

0 Kudos
2 Replies
HarizoR
Developer Advocate

Hi Charly,

Once you have created your user via the API, the create_user() methods returns a handle on the instanciated dataikuapi.dss.admin.DSSUser object. You will need to use this handle to edit the settings in order to add the emailing information, here is a simplified example:

import dataiku
client = dataiku.api_client()
# Here we create the user and retrieve a handle on it. If the user
# is already created, use get_user(user_id) instead.
user = client.create_user(login="bob42",
                          password="bob42",
                          display_name="Bob",
                          source_type="LOCAL",
                          profile="DATA_SCIENTIST")
settings = user.get_settings()
settings.get_raw()["email"] = "bob42@gmail.com"
settings.save()

 

Once this code is run, the "Email" field in the user account properties will be filled accordingly.

Best,

Harizo

 

0 Kudos
Charly
Level 2
Author

Thank you very much !

0 Kudos