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

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. This is mutually exclusive with datasourceId; at least one of them must be specified."group1"
estimatedAffectedRowsIntegerYesEstimated 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.
  • <executor name>: The name of the executor is displayed directly.
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;"

bizData parameters (data export)

ParameterTypeRequiredDescriptionExample
nameStringYesTask name."test"
datasourceIdStringYesID of the associated data source."ds-dbiddumxp4h"
dbNameStringYesName of the associated database."ght"
typeStringYesExport type:
  • sql: Export as SQL statements.
  • database: Export a database.
  • table: Export a table.
"sql"
sqlTextStringNoSQL text. Required when type is sql."select version();"
contentStringYesExport content:
  • data: Data only.
  • structure: Structure only.
  • dataAndStructure: Data and structure.
"data"
fileTypeStringYesExport file type:
  • sql: Export as an SQL file.
  • excel: Export as an Excel file.
  • csv: Export as a CSV file.
"excel"
reasonStringNoReason for the export."test"
executorTypeStringYesExecutor type:
  • creator: The submitter executes the task.
  • approver: The approver executes the task.
  • auto: The task is executed automatically.
"creator"

Response parameters

ParameterTypeDescriptionExample
successBooleanWhether the request was successful.true
dataStringTask ID."st-dd46vm7divwx"
errorCodeStringError code.N/A
messageStringError message.N/A

Successful response example

{
"success": true,
"data": "st-dd46vm7divwx"
}