Webapps#

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 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):
    my_webapp.start_or_restart_backend()

Stop a webapp backend#

my_webapp = project.get_webapp(my_webapp_id)
my_webapp.stop_backend()

Get the settings of a webapp to change its name#

A handle to a webapps settings 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"])
settings.save()

Reference documentation#

dataikuapi.dss.webapp.DSSWebApp(client, ...)

A handle for the webapp.

dataikuapi.dss.webapp.DSSWebAppBackendClient(...)

A client to interact by API with a standard webapp backend

dataikuapi.dss.webapp.DSSWebAppBackendState(...)

A wrapper object holding the webapp backend state.

dataikuapi.dss.webapp.DSSWebAppSettings(...)

A handle for the webapp settings.

dataikuapi.dss.webapp.DSSWebAppListItem(...)

An item in a list of webapps.