查询工作流作业列表

列出当前调用者可读取的工作流执行作业。先通过此接口找到执行 ID,再查询作业详情或结果。

GET https://moi.matrixorigin.cn/newmoi/workflow/v2/workflow-apps/executions

调用前准备

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

下方示例使用:

  • $AI_STUDIO_API_KEY:实际个人访问令牌,通过 X-API-Key Header 传递。

  • $WORKSPACE_ID:要查询的工作区 ID,通过 X-Workspace-ID Header 传递。

查询参数

不传查询参数时,接口返回起始位置的默认数量。使用筛选参数缩小结果范围;使用 offsetlimit 分段读取结果。

参数

类型

是否必填

说明

offset

integer

返回列表的起始位置。

limit

integer

返回数量。

status

string

按作业状态筛选。

execution_mode

string

按执行模式筛选。

workflow_name

string

按工作流名称筛选。

请求示例

curl "https://moi.matrixorigin.cn/newmoi/workflow/v2/workflow-apps/executions?offset=0&limit=20" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

成功响应

成功时返回 200data.total 是匹配总数,data.executions 是当前页的作业摘要。

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "total": 1,
    "executions": [
      {
        "execution_id": "exec-001",
        "dispatch_job_id": "dispatch-001",
        "workflow_id": "wf-001",
        "workflow_name": "daily-import",
        "status": "running",
        "available_actions": ["pause", "cancel"],
        "execution_mode": "one_shot",
        "moi_task_id": "task-001",
        "moi_case_id": "case-001",
        "started_at": "2026-08-18T10:00:00Z",
        "created_at": "2026-08-18T10:00:00Z",
        "updated_at": "2026-08-18T10:01:00Z"
      }
    ]
  }
}

响应字段如下。

本文中,字段路径中的 [] 表示数组中的每一项。例如,items[].name 表示 items 数组中每一项的 name 字段。

字段

类型

说明

code

string

成功时为 OK

msg

string

成功时为 OK

data.total

integer

符合筛选条件的作业总数。

data.executions

object(对象数组)

当前页作业摘要;没有结果时为空数组。

data.executions[].execution_id

string

执行 ID。

data.executions[].workflow_id

string

所属工作流 ID。

data.executions[].dispatch_job_id

string

调度作业 ID;服务端提供时返回。

data.executions[].workflow_name

string

工作流名称;服务端提供时返回。

data.executions[].status

string

当前状态。

data.executions[].execution_mode

string

执行模式。

data.executions[].available_actions

string(字符串数组)

当前状态允许的操作。

data.executions[].cron_expression

string

Cron 表达式;仅定时模式返回。

data.executions[].moi_task_id

string

任务标识;服务端已分配时返回。

data.executions[].moi_case_id

string

案例标识;服务端已分配时返回。

data.executions[].moi_workflow_def_id

string

工作流定义标识;服务端已分配时返回。

data.executions[].moi_workflow_version_id

string

工作流版本标识;服务端已分配时返回。

data.executions[].data_name

string

本次执行关联的数据名称;适用时返回。

data.executions[].file_id

string

本次执行关联的文件 ID;适用时返回。

data.executions[].pause_scope

string

暂停范围;处于暂停状态且服务端提供时返回。

data.executions[].error

string

当前执行错误;有错误时返回。

data.executions[].started_at

string

开始时间;未产生时可能省略。

data.executions[].ended_at

string

结束时间;未产生时可能省略。

data.executions[].created_at

string

创建时间;未产生时可能省略。

data.executions[].updated_at

string

最后更新时间;未产生时可能省略。

读取后续结果

根据 data.total 和请求时的 limit 计算分段次数,再依次增加 offset 读取后续结果。

错误响应

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

常见 HTTP 错误

HTTP 状态码

错误代码

常见原因

建议操作

400

ErrParamInvalid

offsetlimit 不能解析,或筛选参数无效。

检查查询参数类型和取值。

401

ErrUnauthorized

缺少或无效的访问凭据。

检查 API Key 和工作区 Header。

500

ErrServer

服务端未能读取执行列表。

稍后重试。

后续操作

使用 data.executions[].workflow_idexecution_id 查询工作流作业详情

最后更新于