Do you know the History of Data Science? READ MORE

Trigger and Create Scenario using External API's

sj0071992
Level 2
Level 2
Trigger and Create Scenario using External API's

Hi Team,

 

I just want to confirm like, can we trigger or Create a Dataiku Scenario using External Python rest API's?

 

Thanks in Advance

0 Kudos
1 Reply
VitaliyD
Dataiker
Dataiker

Hi @sj0071992,

Yes, you can trigger the scenario programmatically using external Dataiku API. Please find the code sample below:

import dataikuapi

host = "DSS_host"
global_api_key = "your_api_key"
project_key = 'new_model'

​scenario_name = 'scenario_name'
client = dataikuapi.DSSClient(host, global_api_key)
project = client.get_project(project_key)
scenario = project.get_scenario(scenario_name)

​scenario.run_and_wait()

To create a scenario, you will need to use the Projects API create_scenario() function:
https://doc.dataiku.com/dss/latest/python-api/projects.html#dataikuapi.dss.project.DSSProject.create...

For a complete list of available Scenario API functions, please refer to our documentation here:
https://doc.dataiku.com/dss/latest/python-api/scenarios.html
https://doc.dataiku.com/dss/latest/python-api/scenarios-inside.html

Best,
Vitaliy

0 Kudos
A banner prompting to get Dataiku DSS