Sample Job Run
This topic provides a sample job run.
As an example, let’s assume user Alice has created a project titled Risk
Analysis. Under the Risk Analysis project, Alice has created a job with the ID, 208. Using
curl
, Alice can use her API Key
(uysgxtj7jzkps96njextnxxmq05usp0b
) to create an API request as
follows:curl -v -XPOST http://cdsw.example.com/api/v1/projects/alice/risk-analysis/jobs/208/start \
--user "uysgxtj7jzkps96njextnxxmq05usp0b:" --header "Content-type: application/json" \
--data "{\"environment\": {\"START_DATE\": \"2017-01-01\", \"END_DATE\": \"2017-01-31\"}}"
In
this example, START_DATE
and END_DATE
are environment
variables that are passed as parameters to the API request in a JSON object.In the resulting HTTP request, curl
automatically
encodes the Authorization request header in base64 format.
* Connected to cdsw.example.com (10.0.0.3) port 80 (#0)
* Server auth using Basic with user 'uysgxtj7jzkps96njextnxxmq05usp0b'
> POST /api/v1/projects/alice/risk-analysis/jobs/21/start HTTP/1.1
> Host: cdsw.example.com
> Authorization: Basic dXlzZ3h0ajdqemtwczk2bmpleHRueHhtcTA1dXNwMGI6
> User-Agent: curl/7.51.0
> Accept: */*
> Content-type: application/json
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=utf-8
< Date: Mon, 10 Jul 2017 12:00:00 GMT
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
<
{
"engine_id": "cwg6wclmg0x482u0"
}
You can confirm that the job was started by going to the Cloudera Data Science Workbench web application.