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 |
| source | String | No | Call source. | api |
| toolId | String | No | Tool identifier. | tool-1 |
| sourceClient | String | No | Calling client. | client-1 |
| sourceSessionId | String | No | External session ID. | session-1 |
| skillVersion | String | No | Tool version. | 1.0.0 |
| language | String | No | Language for response messages. | enus |
| reason | String | No | Reason for creating the task. | release |
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, used for database-group tasks. | "group1" |
| estimatedAffectedRows | Long | 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;" |
| comment | String | No | Comment. | "release change" |
bizData parameters (data export)
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| name | String | Yes | Task name. | "test" |
| datasourceId | String | Yes | ID of the associated data source. It must start with ds-. | "ds-dbiddumxp4h" |
| databaseName | String | Yes | Name of the associated database. Compatible with dbName. | "ght" |
| dbName | String | No | Database name. Passing this field synchronizes it to databaseName. | "ght" |
| schemaName | String | No | Name of the associated schema. | "public" |
| type | String | Yes | Export type. The OpenAPI task-creation API currently supports only sql. | "sql" |
| sqlStatement | String | Yes | Export SQL. Compatible with sqlText. | "select version();" |
| sqlText | String | No | Export SQL. When passed, it is converted to sqlStatement. | "select version();" |
| content | String | Yes | Export content. Compatible with contentType: data, structure, or dataAndStructure. | "data" |
| contentType | String | No | Export content: data, structure, or dataAndStructure. | "data" |
| fileType | String | Yes | File type: sql, csv, excel, json, xml, or txt. | "excel" |
| charset | String | Yes | Character set: utf8, UTF-8, or gbk. | "utf8" |
| executorType | String | Yes | Executor type: creator, approver, or auto. | "creator" |
Response parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| success | Boolean | Whether the request was successful. | true |
| requestId | String | OpenAPI request ID. | "<requestId>" |
| data | String | Task ID. | "st-dd46vm7divwx" |
| message | String | Error message. | N/A |
Successful response example
{
"success": true,
"requestId": "<requestId>",
"data": "st-dd46vm7divwx"
}