跳转至

版本记录列表



GET /api/v1/pipeline_history/{pl_uuid}/list

概述

返回当前配置和最近90天历史,按id倒序分页;pageSize默认30,首屏返回currentPipelineInfo,historyRecord为轻量元数据。

路由参数

参数名 类型 必选 说明
pl_uuid string Y Pipeline UUID

Query 请求参数

参数名 类型 必选 说明
seqID integer 翻页游标,正整数;取上一页 historyRecord 最后一项的 id,非 uuid 或 configVersion。首屏省略,下一页返回小于该 id 的历史。
允许为空: False
pageSize integer 每页历史记录数量,默认30,最小1,最大100;不计入首屏单独返回的当前版本。
允许为空: False
$minValue: 1
$maxValue: 100

参数补充说明

查询工作空间自定义 Pipeline 的当前配置和已归档的历史版本,适用于版本审计、CI 比对和恢复前选择版本。

分页流程

  1. 首次调用不传 seqID,pageSize 缺省为 30,范围为 1~100。
  2. 首屏 content 包含 currentPipelineInfo(含当前完整 config)及 historyRecord(仅历史元数据,不含 config)。新建或尚未修改的资源,historyRecord 可能为空。
  3. 下一页传入本页 historyRecord 最后一条记录的数字 id 作为 seqID;不要传历史 uuid 或 configVersion。历史按 id 降序返回,下一页只返回 id 小于游标的记录,不重复返回 currentPipelineInfo。
  4. 返回条数小于 pageSize 时可以停止;恰好满页时继续请求,空数组表示没有更多历史。接口不返回总数或页码。

列表仅返回归档时间最近 90 天的历史;当前配置始终从主表获取,不受此窗口限制。分页不是冻结快照,并发产生的新版本需要重新请求首屏查看。持久保存用于审计的历史内容时,应在保留窗口内自行导出保存。

使用前提

使用所属工作空间的 DF-API-KEY 调用 OpenAPI 服务。查询需要读取权限;恢复和克隆需要 Pipeline 管理及写入权限。接口不支持通过请求体指定其他工作空间或操作人。示例中的 Endpoint、资源 UUID 和 API-Key 均为占位符,请替换后调用,不要在日志中输出 API Key。

响应示例使用虚构资源,展示典型业务字段;实际响应可能包含普通 Pipeline 接口的其他字段。调用方应兼容新增字段。

版本字段

字段 含义
configVersion 配置版本号,新建资源从 1 开始;启用、禁用不推进此版本
configVersionAt 此配置版本生成时间,Unix 秒级时间戳,不是毫秒
configVersionOperator / configVersionOperatorInfo 操作人标识及展示信息;无法解析展示信息时可能为空对象
configVersionSource / configVersionAction 版本来源及动作,例如 openapi/modify、history/history_restore
configVersionSourceInfo 来源补充信息;历史操作含 pipelineHistoryUUID、pipelineUUID、configVersion
createAt 历史快照归档时间,可能晚于 configVersionAt;历史列表保留窗口按此字段计算

历史 config.content 和 config.testData 为 Base64 编码字符串。调用方先 Base64 解码,再按 UTF-8 读取;testData 是测试样例,不会因读取或恢复接口自动执行。不要把 configVersionSourceInfo 中的来源版本号当成当前版本号。

异常处理

非法分页参数会被拒绝;资源不存在、已删除或不属于当前工作空间时不能查询。读取失败可按错误类型重试,但不能通过更换资源 UUID 绕过工作空间权限。

请求例子

curl 'https://openapi.guance.com/api/v1/pipeline_history/<pl_uuid>/list?pageSize=30' -H 'DF-API-KEY: <API-Key>'

响应

{
    "code": 200,
    "content": {
        "currentPipelineInfo": {
            "pipelineUUID": "pl_example",
            "configVersion": 3,
            "configVersionAt": 1788800100,
            "configVersionOperator": "acnt_example",
            "configVersionOperatorInfo": {},
            "configVersionSource": "openapi",
            "configVersionAction": "modify",
            "configVersionSourceInfo": {},
            "config": {
                "name": "demo",
                "type": "local",
                "category": "logging",
                "source": [
                    "nginx"
                ],
                "content": "YWRkX2tleShjaXR5LCAic2hhbmdoYWkiKQ==",
                "testData": "W10=",
                "dataType": "line_protocol",
                "asDefault": 0,
                "enableByLogBackup": 0,
                "extend": {}
            }
        },
        "historyRecord": [
            {
                "id": 101,
                "uuid": "plh_example",
                "pipelineUUID": "pl_example",
                "configVersion": 2,
                "configVersionAt": 1788800000,
                "configVersionOperator": "acnt_example",
                "configVersionOperatorInfo": {},
                "configVersionSource": "openapi",
                "configVersionAction": "modify",
                "configVersionSourceInfo": {},
                "createAt": 1788800100
            }
        ]
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE_EXAMPLE"
}

文档评价

文档内容是否对您有帮助?