跳到主要内容

创建工作流任务

创建一个新的工作流任务。

请求地址:/openapi/v1/workflow/create

请求方法:POST

请求参数

参数类型是否必选说明示例
moduleString任务类型:
  • sqlTask:SQL 任务
  • dataExport:数据导出
sqlTask
bizDataObject任务详情。根据 module 参数的不同,需要传入不同的参数。具体请参见本文的 bizData 参数(SQL 任务)bizData 参数(数据导出)
sourceString调用来源。api
toolIdString工具标识。tool-1
sourceClientString调用客户端。client-1
sourceSessionIdString外部会话 ID。session-1
skillVersionString工具版本。1.0.0
languageString返回信息语言。zh_cn
reasonString创建原因。release

bizData 参数(SQL 任务)

参数类型是否必选说明示例
nameString任务名称。"test"
datasourceIdString任务关联的数据源 ID。"ds-dbiddumxp4h"
dbNameString任务关联的数据库名称。"ght"
schemaNameString任务关联的 Schema 名称。"public"
dbGroupIdString任务关联的数据库分组 ID,分组任务场景使用。"group1"
estimatedAffectedRowsLong预估影响行数。12
executorTypeString执行人类型:
  • creator:提交人执行。
  • approver:审批人执行。
  • auto:自动执行。
默认:creator
"creator"
sqlInputTypeStringSQL 文本类型:
  • text:SQL 文本。
  • file:SQL 文件。
默认值:text
"text"
sqlTextStringSQL 文本内容。"select version();"
rollbackTextTypeString回滚文本类型:
  • text:SQL 文本。
  • file:SQL 文件。
默认值:text
"text"
rollbackTextString回滚文本内容。"drop table if exists t1;"
commentString备注。"release change"

bizData 参数(数据导出)

参数类型是否必选说明示例
nameString任务名称。"test"
datasourceIdString任务关联的数据源 ID,必须以 ds- 开头。"ds-dbiddumxp4h"
databaseNameString任务关联的数据库名称,兼容 dbName"ght"
dbNameString数据库名称。传入后会同步到 databaseName"ght"
schemaNameString任务关联的 Schema 名称。"public"
typeString导出类型。当前 OpenAPI 创建任务仅支持 sql"sql"
sqlStatementString导出 SQL,兼容 sqlText"select version();"
sqlTextString导出 SQL。传入后会转换为 sqlStatement"select version();"
contentString导出内容,兼容 contentTypedatastructuredataAndStructure"data"
contentTypeString导出内容:datastructuredataAndStructure"data"
fileTypeString文件类型:sqlcsvexceljsonxmltxt"excel"
charsetString字符集:utf8UTF-8gbk"utf8"
executorTypeString任务执行人:creatorapproverauto"creator"

返回参数

参数类型说明示例
successBoolean请求是否成功。true
requestIdStringOpenAPI 请求 ID。"<requestId>"
dataString任务 ID。"st-dd46vm7divwx"
messageString异常信息。

调用成功示例

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