创建导出任务

创建导出任务,将文件或处理结果写入目标连接器。成功响应表示任务已受理;请使用任务 ID 继续查看实际处理状态。

POST https://api.moi.matrixorigin.cn/v5/export/task/create

调用前准备

  1. 准备有目标工作区访问权限的个人访问令牌目标工作区 ID

  2. 选择一个支持导出的目标连接器,并准备至少一个待导出文件的 ID 和完整路径。

  3. 根据目标类型准备对应的导出配置。MatrixOne 目标需要数据库、表和列映射;对象存储目标需要路径和压缩方式。

请求体

$AI_STUDIO_API_KEY$WORKSPACE_ID$CONNECTOR_ID 和示例中的文件信息替换为实际值。每个请求只填写一个目标配置对象。

curl -X POST "https://api.moi.matrixorigin.cn/v5/export/task/create" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d @- <<EOF
{
    "task_name": "export-orders",
    "creator": "data-engineer",
    "connector_id": "$CONNECTOR_ID",
    "connector_name": "target-mo",
    "type": 3,
    "config": {
      "mo_config": {
        "database_name": "analytics",
        "table_name": "orders",
        "new_table": true,
        "duplicated_strategy": 3,
        "column": {
          "export_column": [{
            "source_column": "content",
            "mapping_column": "content"
          }],
          "combine_column": []
        }
      }
    },
    "files": [{
      "file_id": "file_01",
      "ref_file_id": "raw-file_01",
      "parsed_file_id": "parsed-file_01",
      "full_path": ["volume_01", "orders.csv"],
      "is_raw": false
    }]
  }
EOF

OSS 使用 type4,标准 S3 使用 5;两者均填写 s3_config

curl -X POST "https://api.moi.matrixorigin.cn/v5/export/task/create" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d @- <<EOF
{
    "task_name": "export-to-s3",
    "creator": "data-engineer",
    "connector_id": "$CONNECTOR_ID",
    "connector_name": "target-s3",
    "type": 5,
    "config": {
      "s3_config": {
        "path": "exports/",
        "need_compress": true,
        "compress_method": "gzip"
      }
    },
    "files": [{
      "file_id": "file_01",
      "full_path": ["volume_01", "orders.csv"],
      "is_raw": true
    }]
  }
EOF

直接调用 API 时可使用 Dify 知识库目标;当前创建页面不提供该目标入口。

curl -X POST "https://api.moi.matrixorigin.cn/v5/export/task/create" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d @- <<EOF
{
    "task_name": "export-to-dify",
    "creator": "data-engineer",
    "connector_id": "$CONNECTOR_ID",
    "connector_name": "target-dify",
    "type": 6,
    "config": {
      "dify_config": {
        "dataset_id": "dataset-001",
        "dataset_name": "support-kb",
        "embedding_model": "text-embedding-model"
      }
    },
    "files": [{
      "file_id": "file_01",
      "full_path": ["volume_01", "orders.csv"],
      "is_raw": false
    }]
  }
EOF

参数

类型

是否必填

说明

task_name

string

导出任务名称。

creator

string

创建者标识。

connector_id

string

目标连接器 ID。

connector_name

string

保存到任务中的目标连接器名称。

type

integer

MatrixOne 目标使用 3

config

object

目标配置;本场景只填写 mo_config

config.mo_config

object

MatrixOne 目标配置。

config.mo_config.database_name

string

目标数据库名称。

config.mo_config.table_name

string

目标表名称。

config.mo_config.new_table

boolean

是否新建目标表。

config.mo_config.duplicated_strategy

integer

重复数据处理方式:1 覆盖、2 跳过、3 保留。

config.mo_config.column

object

导出列配置。

config.mo_config.column.export_column

array of object

源列与目标列的映射。

config.mo_config.column.export_column.source_column

string

源列名。

config.mo_config.column.export_column.mapping_column

string

目标列名。

config.mo_config.column.combine_column

array of string

要合并处理的源列;不合并时传空数组。

files

array of object

待导出文件,至少一项。

files.file_id

string

源文件 ID。

files.ref_file_id

string

关联的原始文件 ID。

files.parsed_file_id

string

关联的解析产物文件 ID。

files.full_path

array of string

从卷根目录到文件的完整路径。

files.is_raw

boolean

false 表示导出处理结果。

参数

类型

是否必填

说明

task_name

string

导出任务名称。

creator

string

创建者标识。

connector_id

string

目标连接器 ID。

connector_name

string

保存到任务中的目标连接器名称。

type

integer

标准 S3 目标使用 5

config

object

目标配置;本场景只填写 s3_config

config.s3_config

object

对象存储目标配置。

config.s3_config.path

string

存储桶内的目标路径。

config.s3_config.need_compress

boolean

是否压缩本次导出内容。

config.s3_config.compress_method

string

压缩方式。

files

array of object

待导出文件,至少一项。

files.file_id

string

源文件 ID。

files.full_path

array of string

从卷根目录到文件的完整路径。

files.is_raw

boolean

true 表示导出原始文件。

参数

类型

是否必填

说明

task_name

string

导出任务名称。

creator

string

创建者标识。

connector_id

string

目标连接器 ID。

connector_name

string

保存到任务中的目标连接器名称。

type

integer

Dify 知识库目标使用 6

config

object

目标配置;本场景只填写 dify_config

config.dify_config

object

Dify 知识库目标配置。

config.dify_config.dataset_id

string

目标知识库 ID。

config.dify_config.dataset_name

string

保存到任务中的知识库名称。

config.dify_config.embedding_model

string

知识库使用的嵌入模型标识。

files

array of object

待导出文件,至少一项。

files.file_id

string

源文件 ID。

files.full_path

array of string

从卷根目录到文件的完整路径。

files.is_raw

boolean

false 表示导出处理结果。

成功响应

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "id": "export-task-123",
    "name": "export-orders",
    "connector_name": "target-mo",
    "type": 3,
    "status": 1,
    "export_source": [["volume_01", "orders.csv"]],
    "create_time": "2026-08-28T10:00:00Z",
    "end_time": null,
    "fileSuccess": 0,
    "fileFail": 0
  }
}

字段

类型

说明

code

string

成功时为 OK

msg

string

成功时为 OK

data

object

新建任务。

data.id

string

任务 ID。

data.name

string

任务名称。

data.connector_name

string

目标连接器名称。

data.type

integer

导出目标类型。

data.status

integer

任务状态。

data.export_source

array of array of string

来源文件路径集合。

data.create_time

string 或 null

创建时间。

data.end_time

string 或 null

结束时间。

data.fileSuccess

integer

已成功导出的文件数。

data.fileFail

integer

导出失败的文件数。

错误响应

{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效",
  "data": null
}

字段

类型

说明

code

string

错误代码。

msg

string

可读错误信息。

data

null

错误响应中为 null

后续操作

记录 data.id。使用查看导出任务状态查看导出任务文件列表确认文件处理结果。

最后更新于