The webapps API can control all aspects of managing a webapp.

Example use cases#

In all examples, project is a dataikuapi.dss.project.DSSProject handle, obtained using client.get_project() or client.get_default_project()

List the webapps of a project and get a handle for the first one#

By default, list_webapps() returns a list of dict items describing the webapps of a project. From the dict item, the dataikuAPI.dss.webapp.DSSWebApp handle can be obtained using the to_webapp() method. Documentation of the list_webapps() and get_webapp() methods can be found in the API projects documentation.

project_webapps = project.list_webapps()
my_webapp_dict = project_webapps[0]
print("Webapp name : %s" % my_webapp_dict["name"])
print("Webapp id : %s" % my_webapp_dict["id"])
my_webapp = project_webapps[0].to_webapp()

Get a webapp by id, check if the webapp is running and if not, start it#

A handle to a webapps state dataikuAPI.dss.webapp.DSSWebAppBackendState object can be obtained using the get_state() method.

my_webapp = project.get_webapp(my_webapp_id)
if (not my_webapp.get_state().running):

Stop a webapp backend#

my_webapp = project.get_webapp(my_webapp_id)

Get the settings of a webapp to change its name#

A handle to a webapps settings dataikuAPI.dss.webapp.DSSWebAppSettings object can be obtained using the get_settings() method.

my_webapp = project.get_webapp(my_webapp_id)
settings = my_webapp.get_settings()
print("Current webapp name : %s" % settings.data["name"])
settings.data["name"] = "new webapp name"
print("New webapp name : %s" % settings.data["name"])

Reference documentation#