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 !
Best Answer
-
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
Answers
-
Charly Partner, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Dataiku DSS Adv Designer, Registered Posts: 13 Partner
Thank you very much !