Starting a Job Run Using the API

Once a job has been created and configured through the Cloudera Data Science Workbench web application, you can start a run of the job through the API. This will constitute sending a POST request to a job start URL of the form:<$USERNAME>/<$PROJECT_NAME>/jobs/<$JOB_ID>/start.

To construct a request, use the following steps to derive the username, project name, and job ID from the job's URL in the web application.
  1. Log in to the Cloudera Data Science Workbench web application.
  2. Switch context to the team/personal account where the parent project lives.
  3. Select the project from the list.
  4. From the project's Overview, select the job you want to run.
    This will take you to the job Overview page. The URL for this page is of the form:<$USERNAME>/<$PROJECT_NAME>/jobs/<$JOB_ID>.
  5. Use the $USERNAME, $PROJECT_NAME, and $JOB_ID parameters from the job Overview URL to create the following job start URL:<$USERNAME>/<$PROJECT_NAME>/jobs/<$JOB_ID>/start
    For example, if your job Overview page has the URL, then a sample POST request would be of the form:
    curl -v -XPOST    \
    --user "<API_KEY>:" --header "Content-type: application/json"
        "environment": {
            "ENV_VARIABLE": "value 1",
            "ANOTHER_ENV_VARIABLE": "value 2"