Create a Workflow Task
Use this API to create a workflow task.
Request URL: /openapi/v1/workflow/create
HTTP method: POST
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| module | String | Yes | Task type:
| sqlTask |
| bizData | Object | Yes | Task details. The required fields depend on the module value. For details, see bizData parameters (SQL task) or bizData parameters (data export). | N/A |
bizData parameters (SQL task)
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| name | String | Yes | Task name. | "test" |
| datasourceId | String | Yes | ID of the associated data source. | "ds-dbiddumxp4h" |
| dbName | String | Yes | Name of the associated database. | "ght" |
| schemaName | String | No | Name of the associated schema. | "public" |
| dbGroupId | String | No | ID of the associated database group. This is mutually exclusive with datasourceId; at least one of them must be specified. | "group1" |
| estimatedAffectedRows | Integer | Yes | Estimated number of affected rows. | 12 |
| executorType | String | No | Executor type:
| "creator" |
| sqlInputType | String | No | SQL input type:
| "text" |
| sqlText | String | Yes | SQL text. | "select version();" |
| rollbackTextType | String | No | Rollback text type:
| "text" |
| rollbackText | String | No | Rollback text. | "drop table if exists t1;" |
bizData parameters (data export)
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| name | String | Yes | Task name. | "test" |
| datasourceId | String | Yes | ID of the associated data source. | "ds-dbiddumxp4h" |
| dbName | String | Yes | Name of the associated database. | "ght" |
| type | String | Yes | Export type:
| "sql" |
| sqlText | String | No | SQL text. Required when type is sql. | "select version();" |
| content | String | Yes | Export content:
| "data" |
| fileType | String | Yes | Export file type:
| "excel" |
| reason | String | No | Reason for the export. | "test" |
| executorType | String | Yes | Executor type:
| "creator" |
Response parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| success | Boolean | Whether the request was successful. | true |
| data | String | Task ID. | "st-dd46vm7divwx" |
| errorCode | String | Error code. | N/A |
| message | String | Error message. | N/A |
Successful response example
{
"success": true,
"data": "st-dd46vm7divwx"
}