Skip to main content

Create a Workflow Task

Use this API to create a workflow task.

Request URL: /openapi/v1/workflow/create

HTTP method: POST

Request parameters

ParameterTypeRequiredDescriptionExample
moduleStringYesTask type:
  • sqlTask: SQL task
  • dataExport: Data export
sqlTask
bizDataObjectYesTask details. The required fields depend on the module value. For details, see bizData parameters (SQL task) or bizData parameters (data export).N/A
sourceStringNoCall source.api
toolIdStringNoTool identifier.tool-1
sourceClientStringNoCalling client.client-1
sourceSessionIdStringNoExternal session ID.session-1
skillVersionStringNoTool version.1.0.0
languageStringNoLanguage for response messages.enus
reasonStringNoReason for creating the task.release

bizData parameters (SQL task)

ParameterTypeRequiredDescriptionExample
nameStringYesTask name."test"
datasourceIdStringYesID of the associated data source."ds-dbiddumxp4h"
dbNameStringYesName of the associated database."ght"
schemaNameStringNoName of the associated schema."public"
dbGroupIdStringNoID of the associated database group, used for database-group tasks."group1"
estimatedAffectedRowsLongYesEstimated number of affected rows.12
executorTypeStringNoExecutor type:
  • creator: The submitter executes the task.
  • approver: The approver executes the task.
  • auto: The task is executed automatically.
Default: creator.
"creator"
sqlInputTypeStringNoSQL input type:
  • text: SQL text.
  • file: SQL file.
Default: text.
"text"
sqlTextStringYesSQL text."select version();"
rollbackTextTypeStringNoRollback text type:
  • text: SQL text.
  • file: SQL file.
Default: text.
"text"
rollbackTextStringNoRollback text."drop table if exists t1;"
commentStringNoComment."release change"

bizData parameters (data export)

ParameterTypeRequiredDescriptionExample
nameStringYesTask name."test"
datasourceIdStringYesID of the associated data source. It must start with ds-."ds-dbiddumxp4h"
databaseNameStringYesName of the associated database. Compatible with dbName."ght"
dbNameStringNoDatabase name. Passing this field synchronizes it to databaseName."ght"
schemaNameStringNoName of the associated schema."public"
typeStringYesExport type. The OpenAPI task-creation API currently supports only sql."sql"
sqlStatementStringYesExport SQL. Compatible with sqlText."select version();"
sqlTextStringNoExport SQL. When passed, it is converted to sqlStatement."select version();"
contentStringYesExport content. Compatible with contentType: data, structure, or dataAndStructure."data"
contentTypeStringNoExport content: data, structure, or dataAndStructure."data"
fileTypeStringYesFile type: sql, csv, excel, json, xml, or txt."excel"
charsetStringYesCharacter set: utf8, UTF-8, or gbk."utf8"
executorTypeStringYesExecutor type: creator, approver, or auto."creator"

Response parameters

ParameterTypeDescriptionExample
successBooleanWhether the request was successful.true
requestIdStringOpenAPI request ID."<requestId>"
dataStringTask ID."st-dd46vm7divwx"
messageStringError message.N/A

Successful response example

{
"success": true,
"requestId": "<requestId>",
"data": "st-dd46vm7divwx"
}