Python API - get dss instance name

Solved!
JohnB
Level 3
Python API - get dss instance name

How can I obtain the DSS Instance Name as a variable that I see in DSS Settings?

0 Kudos
1 Solution
ATsao
Dataiker

Hi John,

You will want to use the get_general_settings() call as can be found in our Python API documentation here:

https://doc.dataiku.com/dss/latest/python-api/rest-api-client/other-administration.html

For example, something like the following should retrieve you the DSS instance name (found under Administration > Settings > Themes & Customizations > DSS instance name)

 

# Instantiate client (assuming code is run from inside DSS)
import dataiku
client = dataiku.api_client()

# Retrieve name from raw settings definition
settings = client.get_general_settings()
name = settings.get_raw()['nodeName']

 

Hopefully, this helps and is what you are looking for! 

Best,

Andrew

View solution in original post

3 Replies
ATsao
Dataiker

Hi John,

You will want to use the get_general_settings() call as can be found in our Python API documentation here:

https://doc.dataiku.com/dss/latest/python-api/rest-api-client/other-administration.html

For example, something like the following should retrieve you the DSS instance name (found under Administration > Settings > Themes & Customizations > DSS instance name)

 

# Instantiate client (assuming code is run from inside DSS)
import dataiku
client = dataiku.api_client()

# Retrieve name from raw settings definition
settings = client.get_general_settings()
name = settings.get_raw()['nodeName']

 

Hopefully, this helps and is what you are looking for! 

Best,

Andrew

JohnB
Level 3
Author

Hi Andrew,

Thanks for the response.

Does this require an admin account to access this?

Regards,

John

0 Kudos
ATsao
Dataiker

Hi John,

Yep, that is correct. What you can do through the API is simply an extension of what you can do through the UI with your user. In this case, since only global admin users can view and update general settings, you'll need to be using an admin account or generate a global admin API key if using the APIs outside of DSS.

Thanks,

Andrew 

0 Kudos