查询工作流作业列表

列出工作流作业,可按状态和执行方式筛选。

GET https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-apps/{workflow_id}/executions

调用前准备

先查询工作流详情确认目标工作流可读取并取得工作流 ID。详情返回 404 时,核对 ID 后再调用列表。准备具有工作流读取权限的个人访问令牌和目标工作区 ID。

路径参数

将 $AI_STUDIO_API_KEY、$WORKSPACE_ID 和 $WORKFLOW_ID 替换为实际值。

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

参数

类型

是否必填

说明

workflow_id

string

是

工作流 ID。

offset

integer

否

从 0 开始的偏移量。

limit

integer

否

本次返回数量上限。

status

string

否

按作业状态筛选。

execution_mode

string

否

按执行方式筛选。

workflow_name

string

否

按工作流名称筛选。使用全局作业列表入口时适用。

查询目标工作区中当前调用者可读取的全部工作流作业时,使用 /v5/workflow/v2/workflow-apps/executions,不传路径参数 workflow_id。

偏移量需非负,显式页大小范围为 1–200。状态和运行方式按精确枚举筛选。cancelled 和 canceled 合并匹配历史值。名称查询保留 SQL LIKE 的 %、_ 通配符。列表先筛选持久化状态,再补运行时状态,因此返回状态可能与筛选值不同。

成功响应

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "total": 1,
    "executions": [
      {
        "execution_id": "run-001",
        "workflow_id": "wf-001",
        "status": "completed",
        "execution_mode": "one_shot",
        "workflow_name": "daily-import"
      }
    ]
  }
}

字段

类型

说明

code

string

成功代码。

msg

string

响应信息。

data

object

本次操作返回的数据。

data.total

integer

当前筛选条件下的总数。

data.executions

object(对象数组)

作业列表。

data.executions[].execution_id

string

作业 ID。

data.executions[].workflow_id

string

工作流 ID。

data.executions[].status

string

状态。取值为 preparing、waiting、pending、triggered、running、completed、failed、cancelled、submitted、scheduled、paused、canceled、success、succeeded、queued、cancelling、canceling

data.executions[].available_actions

string(字符串数组)

当前状态对应的操作提示,不表示已通过当前用户的权限检查。

data.executions[].execution_mode

string

运行方式。取值为 one_shot、volume_trigger、cron、dynamic_service、task_by_version

data.executions[].cron_expression

string

Cron 表达式。

data.executions[].moi_task_id

string

任务 ID。

data.executions[].moi_case_id

string

运行案例 ID。

data.executions[].moi_workflow_def_id

string

工作流定义 ID。

data.executions[].moi_workflow_version_id

string

工作流版本 ID。

data.executions[].dispatch_job_id

string

卷分发作业 ID。

data.executions[].pause_scope

string

暂停范围。取值为 execution、workflow

data.executions[].error

string

错误信息。

data.executions[].started_at

string

开始时间。采用 RFC 3339 格式。

data.executions[].ended_at

string

结束时间。采用 RFC 3339 格式。

data.executions[].created_at

string

创建时间。采用 RFC 3339 格式。

data.executions[].updated_at

string

最近更新时间。采用 RFC 3339 格式。

data.executions[].workflow_name

string

显示信息。

data.executions[].data_name

string

显示信息。

data.executions[].file_id

string

关联标识。

错误响应

以下为查询参数无效时的 HTTP 400 响应。不能依赖作业列表返回 404 来确认工作流是否存在。

{
  "code": "ErrParamInvalid",
  "msg": "Bad Request"
}

字段

类型

说明

code

string

错误代码。

msg

string

可读错误信息。

常见 HTTP 错误

HTTP 状态码

错误代码

常见原因

建议操作

400

ErrParamInvalid、ErrWorkspaceRequired

请求字段、工作区或操作前置条件无效。

修正参数后再提交。

401

Unauthorized

认证凭据缺失或无效。

检查凭据类型、有效期及认证头。

403

ErrForbidden

当前身份或有效角色无执行该操作的权限。

使用有权限的身份,或联系管理员授权。

404

ErrNotFound

目标对象或所需引用未找到。

核对对象标识、所属工作区和当前状态。

409

ErrConflict

资源状态、请求内容或并发条件冲突。

重新读取当前状态和版本,按实际结果处理。

500

ErrServer

内部处理失败;写操作可能已有部分效果。

保留请求和追踪信息,先核对当前结果。

503

ErrServiceUnavailable

业务、运行时或授权依赖暂不可用。

恢复依赖后先核对已有结果,不自动重复写入。

最后更新于