分页列出 Schedule Run 执行记录。
GET /api/v1/forward/schedule_runs
查询某个 Identity 下的 Schedule Run;传入 schedule_id 可收敛到单个 Schedule。
该接口仅允许 PAT 或管理员 SAT;Identity-bound SAT 即使指定自己的 identity_id,也不能调用。
请求头
| Header | 是否必填 | 说明 |
|---|---|---|
| Authorization | 是 | Bearer <PAT 或管理员 SAT> |
查询参数
| 参数 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| identity_id | string | 是 | - | Run 所属 Forward Identity ID。 |
| schedule_id | string | 否 | - | 按 Schedule ID 过滤。 |
| status | string | 否 | - | 按 pending、running、completed、failed 或 skipped 过滤。 |
| trigger_type | string | 否 | - | 按 schedule 或 manual 过滤。 |
| has_error | boolean | 否 | - | 是否只返回有错误或无错误的 Run。 |
| limit | integer | 否 | 20 | 分页大小,最大 100。 |
| after_id | string | 否 | - | 向后翻页游标。 |
| before_id | string | 否 | - | 向前翻页游标。 |
| sort_by | string | 否 | created_at | 排序字段:created_at 或 triggered_at。 |
| order | string | 否 | desc | 排序方向:asc 或 desc。 |
示例请求
示例响应
HTTP 200 OK
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| data | Schedule Run 对象数组 | 当前页记录。 |
| first_id | string|null | 当前页第一条 Run ID。 |
| last_id | string|null | 当前页最后一条 Run ID。 |
| has_more | boolean | 是否还有更多记录。 |
错误
| HTTP | Type | Code | 触发条件 |
|---|---|---|---|
| 400 | invalid_request_error | invalid_identity | identity_id 缺失或为空。 |
| 400 | invalid_request_error | invalid_request | status、trigger_type、sort_by、order 不合法,同时传入 after_id 和 before_id,或 identity_id、schedule_id、游标等字符串含不支持的控制字符。 |
| 400 | invalid_request_error | invalid_has_error | has_error 无法解析为 boolean。 |
| 400 | invalid_request_error | invalid_limit | limit 不在 1~100 范围内或不是整数。 |
| 401 | authentication_error | - | PAT 或 SAT 无效或已过期。 |
| 403 | permission_error | - | Identity-bound SAT 调用仅允许 PAT 或管理员 SAT 的接口;message 为 admin service account token required,响应不包含 error.code。 |
备注
- Schedule Run 是独立资源。
- 默认按
(created_at, run_id)倒序返回;指定sort_by=triggered_at时按(triggered_at, run_id)稳定排序。 after_id与before_id不能同时传;游标会按当前sort_by和order解析,切换排序方式时应重新开始分页。- 为保持 v1 兼容性,非空且不含控制字符的
after_id/before_id如果在当前 owner/Identity 下找不到,服务端会忽略该游标并返回当前筛选与排序条件的第一页。调用方不应依赖该容错,应仅原样回传同一 owner/Identity、sort_by和order下上一页返回的first_id/last_id。 completed、failed和skipped是终态。push_status表达 IM 流式投递状态,和主流程status相互独立。