API v1 - Tasks

API v1 - Tasks


Below we list some common API commands for Task management in Matillion ETL by way of an example use with cURL. These commands should be immediately usable with cURL when the <bracketed> details are substituted with details from your own Matillion ETL instance.

Run job
curl -X POST -u user:password http://<InstanceAddress>/rest/v1/group/name/<GroupName>/project/name/<ProjectName>/version/name/<VersionName>/job/name/<JobName>/run?environmentName=<EnvironmentName>

List Running tasks

curl -X GET user:password "http://<InstanceAddress>/rest/v1/group/name/<GroupName>/project/name/<ProjectName>/task/running"

Cancel task

curl -X POST user:password "http://<InstanceAddress>/rest/v1/group/name/<GroupName>/project/name/<ProjectName>/task/id/<TaskId>/cancel"

Task History

The below example gets all history between the two specified dates (in this case, between 00:00 and 23:59 on 2019-01-01).

curl -X GET -u <user>:<password> -H "Content-Type: application/json" "http://<InstanceAddress>/rest/v1/group/name/<GroupName>/project/name/<ProjectName>/task/filter/by/start/range/date/2019-01-01/time/00:00/to/date/2019-01-01/time/23:59"


Below is an example of the v1 API being called from a Bash Script Component. This script uses Automatic Variables to populate relevant detail and also passes some Job and Grid Variables.

export JPATH="$project_group_name/project/name/$project_name/version/name/$version_name/job/name/$job_name/run?environment=DEV"

# replace spaces with %20
export JPATH="${JPATH// /%20}"

# Launch job
curl -X POST --insecure \\
-u api-user:api-user \\
"$JPATH" \\
-H 'Content-Type: application/json' \\
-d @- << EOF
"scalarVariables": {"recursion_type":"$recursion_type",
"delay_minutes": "$delay_minutes",
"run_type": "Immediate Job run using 'API'"

"gridVariables" : {"gridvar1": [["R1C1", "R1C2"], ["R2C1", "R2C2"]]}
    curl -u api-user:password GET ''