Skip to content

获取执行记录列表

📋 分页查询执行记录

此接口用于分页查询当前用户的所有工作流执行记录。支持按页码和页大小进行分页查询。

接口描述

根据 API KEY 获取对应用户的工作流执行记录列表。支持分页查询,可获取用户的执行历史记录。

请求方式

GET https://newapi.iflyrpa.com/api/rpa-openapi/executions/get?pageNo=1&pageSize=10

认证要求

需要带 BEARER KEY

请在请求头中添加:

Authorization: Bearer {YOUR_API_KEY}

查询参数

参数名类型必填说明
pageNoInteger页码,从 1 开始,默认值为 1
pageSizeInteger每页记录数,默认值为 10,最大值为 100

响应格式

成功响应 (HTTP 200)

json
{
  "code": "0000",
  "msg": "",
  "data": {
    "executions": [
      {
        "id": "6cef46ae-198d-440a-bef6-816bbefd3adf",
        "project_id": "2008381617971200000",
        "status": "COMPLETED",
        "parameters": {},
        "result": {
          "code": "0000",
          "msg": "运行成功",
          "data": {
            "right": 71
          },
          "video_path": "D:\\rpa\\data\\logs\\2008381617971200000\\2008840517644636160.mp4"
        },
        "error": null,
        "exec_position": "EXECUTOR",
        "version": 2,
        "user_id": "5df30eb2-4737-4515-bb3f-d11236086e7",
        "start_time": "2026-01-07T17:57:56",
        "end_time": "2026-01-07T09:58:11"
      },
      {
        "id": "49b9771c-975e-40e5-b517-64bc24a2feef",
        "project_id": "2008381617971200000",
        "status": "FAILED",
        "parameters": {},
        "result": null,
        "error": "'str' object has no attribute 'get'",
        "exec_position": "EXECUTOR",
        "version": 2,
        "user_id": "5df30eb2-4737-4515-bb3f-d11236086e7",
        "start_time": "2026-01-06T14:16:11",
        "end_time": "2026-01-06T06:16:25"
      }
    ],
    "total": 2,
    "pageNo": 1,
    "pageSize": 10,
    "total_pages": 1
  }
}

响应字段说明

顶层字段

字段名类型说明
codeString响应代码,"0000" 表示成功
msgString响应消息
dataObject返回的数据对象

data 字段

字段名类型说明
executionsArray执行记录数组
totalInteger总记录数
pageNoInteger当前页码
pageSizeInteger每页记录数
total_pagesInteger总页数

executions 数组项字段

字段名类型说明
idString执行 ID
project_idString工作流项目 ID
statusString执行状态,可选值:
- PENDING 运行中
- COMPLETED 已完成
- FAILED 失败
parametersObject工作流输入参数
resultObject执行结果,格式取决于工作流定义
errorString错误信息,仅在失败时有值
exec_positionString执行位置
versionInteger工作流版本号
user_idString执行用户 ID
start_timeString开始时间(ISO 8601 格式)
end_timeString结束时间(ISO 8601 格式),运行中时为 null

说明

  • 此接口返回当前 API KEY 对应用户的所有执行记录,具体状态示例可见 获取指定工作流运行结果
  • 支持分页查询,默认每页 10 条记录
  • 执行记录按开始时间倒序排列(最新的在前面)
  • 成功完成的执行在 result 字段中包含执行结果
  • 失败的执行在 error 字段中包含错误信息
  • 部分执行结果可能包含 video_path 字段,表示执行录屏文件路径

代码示例

cURL

bash
curl -X GET "https://newapi.iflyrpa.com/api/rpa-openapi/executions/get?pageNo=1&pageSize=10" \
  -H "Authorization: Bearer {YOUR_API_KEY}"

Python

python
import requests

url = "https://newapi.iflyrpa.com/api/rpa-openapi/executions/get"
headers = {
    "Authorization": "Bearer {YOUR_API_KEY}"
}
params = {
    "pageNo": 1,
    "pageSize": 10
}

response = requests.get(url, headers=headers, params=params)
result = response.json()
print(result)

# 获取执行记录列表
executions = result['data']['executions']
total = result['data']['total']
print(f"总共 {total} 条记录")

for execution in executions:
    print(f"执行ID: {execution['id']}, 状态: {execution['status']}, 开始时间: {execution['start_time']}")

JavaScript

javascript
const apiKey = "{YOUR_API_KEY}";
const url = "https://newapi.iflyrpa.com/api/rpa-openapi/executions/get?pageNo=1&pageSize=10";

fetch(url, {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${apiKey}`
  }
})
  .then(response => response.json())
  .then(result => {
    console.log(result);
    
    const executions = result.data.executions;
    const total = result.data.total;
    
    console.log(`总共 ${total} 条记录`);
    
    executions.forEach(execution => {
      console.log(`执行ID: ${execution.id}, 状态: ${execution.status}, 开始时间: ${execution.start_time}`);
    });
  })
  .catch(error => console.error("Error:", error));

分页查询示例(Python)

python
import requests

def get_executions_page(page_no=1, page_size=10):
    url = "https://newapi.iflyrpa.com/api/rpa-openapi/executions/get"
    headers = {
        "Authorization": "Bearer {YOUR_API_KEY}"
    }
    params = {
        "pageNo": page_no,
        "pageSize": page_size
    }
    
    response = requests.get(url, headers=headers, params=params)
    return response.json()

# 获取第一页
result = get_executions_page(page_no=1, page_size=5)
executions = result['data']['executions']
total_pages = result['data']['total_pages']

print(f"第一页有 {len(executions)} 条记录,总共 {total_pages} 页")

# 如果有多页,可以继续获取
if total_pages > 1:
    for page in range(2, total_pages + 1):
        result = get_executions_page(page_no=page, page_size=5)
        executions = result['data']['executions']
        print(f"第 {page} 页有 {len(executions)} 条记录")