Create Task Definition
Endpoint: POST /api/metadata/taskdefs
Creates a new task definition.
Request body
Parameter | Description | Type | Required/ Optional |
---|---|---|---|
name | A unique name for the task. Note: It is recommended to use alphanumeric characters for task names. While special characters are allowed for backward compatibility, they are not fully supported and may cause unexpected behavior. | string | Required. |
description | A brief description of the task. | string | Optional. |
retryCount | The number of retry attempts if the task fails. | integer | Optional. |
retryDelaySeconds | The time (in seconds) to wait before each retry attempt. | integer | Optional. |
backOffScaleFactor | The value multiplied with retryDelaySeconds to determine the interval for retry. | integer | Optional. |
retryLogic | The policy that determines the retry mechanism for the tasks. Supported values:
| string | Optional. |
rateLimitPerFrequency | The maximum number of task executions that can be scheduled in a given duration. | integer | Optional. |
rateLimitFrequencyInSeconds | The frequency window (in seconds) for the rate limit. | integer | Optional. |
concurrentExecLimit | The number of task executions that can be executed concurrently. | integer | Optional. |
timeOutSeconds | The maximum duration in seconds for the task to reach a terminal state before it gets marked as TIMED_OUT. No timeout occurs if the value is set to 0. | integer | Required. |
responseTimeoutSeconds | The maximum duration in seconds that a worker has to respond to the server with a status update before it gets marked as TIMED_OUT. | integer | Optional. |
pollTimeoutSeconds | The maximum duration in seconds that a worker has to poll a task before it gets marked as TIMED_OUT. No timeout occurs if the value is set to 0. | integer | Optional. |
timeoutPolicy | The policy for handling timeout. Supported values:
| string | Optional. |
totalTimeoutSeconds | The total duration (in seconds) after which the task will be TIMED_OUT, regardless of the retry configuration. Once this duration is reached, no further retries will be attempted. | integer | Required. |
enforceSchema | Whether to enforce input/output schema validation for all instances of the task. Set to true to enable validation or false to disable. | boolean | Optional. |
inputSchema | The schema to be used as the input schema for the task definition. Learn more about creating and using schemas. | object | Required if enforceSchema is set to true. |
outputSchema | The schema to be used as the output schema for the task definition. Learn more about creating and using schemas. | object | Required if enforceSchema is set to true. |
inputTemplate | The default template values to be supplied for every instance of the task definition. Learn more about using input templates. | object | Optional. |
inputKeys | Keys representing the expected input for the task. | array | Optional. |
outputKeys | Keys representing the expected output from the task. | array | Optional. |
tags | A key-value map to add tags to the task definition. Each tag consists of a key associated with a corresponding value. | object | Optional. |
ownerEmail | The email address of the user creating the task definition. | string | Required. |
Response
Returns 200 OK, indicating that the task definition has been created successfully.
Examples
Create a new task definition
Request
curl -X 'POST' \
'https://<YOUR_CLUSTER>/api/metadata/taskdefs' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-d '{
"name": "sample-api-test",
"description": "Task created using API",
"retryCount": 3,
"timeoutSeconds": 3600,
"timeoutPolicy": "TIME_OUT_WF",
"retryLogic": "FIXED",
"retryDelaySeconds": 60,
"responseTimeoutSeconds": 600,
"rateLimitPerFrequency": 0,
"rateLimitFrequencyInSeconds": 1,
"ownerEmail": "john.doe@acme.com",
"pollTimeoutSeconds": 3600,
"inputKeys": [
"abc"
],
"outputKeys": [
"xyz"
],
"inputTemplate": {
"someKey": "someValue"
},
"backoffScaleFactor": 1,
"concurrentExecLimit": 0
}'
Response
Returns 200 OK, indicating that the task definition has been created successfully.
Create a new task definition enforcing Schema
Request
curl -X 'POST' \
'https://<YOUR-CLUSTER>/api/metadata/taskdefs' \
-H 'accept: */*' \
-H 'X-Authorization: <TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"name": "simple-http-task",
"description": "HTTP task to call external service",
"retryCount": 2,
"timeoutSeconds": 1800,
"inputKeys": [
"url",
"method"
],
"outputKeys": [
"httpStatus",
"responseBody"
],
"timeoutPolicy": "RETRY",
"retryLogic": "LINEAR_BACKOFF",
"retryDelaySeconds": 30,
"responseTimeoutSeconds": 300,
"concurrentExecLimit": 1,
"inputTemplate": {
"method": "GET"
},
"rateLimitPerFrequency": 0,
"rateLimitFrequencyInSeconds": 1,
"ownerEmail": "john.doe@acme.com",
"pollTimeoutSeconds": 60,
"backoffScaleFactor": 2,
"totalTimeoutSeconds": 0,
"inputSchema": {
"createTime": 0,
"updateTime": 0,
"name": "basic-workflow-input",
"version": 1,
"type": "JSON"
},
"outputSchema": {
"name": "my_schema",
"version": 1,
"type": "JSON"
},
"enforceSchema": true
}'
Response
Returns 200 OK, indicating that the task definition has been created successfully.