Skip to content

获取记录列表

filters、关键字、时间和分页条件获取记录列表,支持 jsonjson-ldmarkdown 三种输出格式。

本文档聚焦列表接口自己的查询与分页语义;data.list[] 中每一条记录的内容结构,与 获取单条记录 在相同 format 下的 data.data 保持一致。

请求示例

python
import requests

url = 'https://open.cli.im/api/v2/rpc/record/getRecords'
data = {
    'filters': {
        'record_template': {'id': 122507},
        'qrcode': {'id': 6762875}
    },
    'format': 'json',
    'search_key': '张三',
    'record_type': 0,
    'page_size': 10,
    'get_total_count': 1
}
headers = {
    'Authorization': 'Bearer <你的API Key>',
    'Content-Type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)
print(response.text)
bash
curl -X POST 'https://open.cli.im/api/v2/rpc/record/getRecords' \
  -H 'Authorization: Bearer <你的API Key>' \
  -H 'Content-Type: application/json' \
  -d '{"filters": {"record_template": {"id": 122507}, "qrcode": {"id": 6762875}}, "format": "json", "page_size": 10}'

请求参数

参数类型必填说明
formatstring输出格式,默认 json。可选值:jsonjson-ldmarkdown
search_keystring组件内容关键字模糊查询,对记录内字段全文检索
filtersobject筛选条件对象,可组合使用;详见下方「filters 子字段说明」
record_typeinteger记录类型筛选:0 全部,3 状态变更,7 子码编辑。默认 0
start_timestring | integer开始时间,支持 Unix 时间戳或 ISO 8601 字符串
end_timestring | integer结束时间,支持 Unix 时间戳或 ISO 8601 字符串
page_sizeinteger每页记录数,最大 50,默认 10
page_tokenstring分页游标,由上一页响应返回
last_record_idinteger记录 ID 偏移,从此 ID 之后开始查
order_bystring排序方式,格式为 {字段},{方向}。支持 submit_at,desc(按提交时间降序)和 submit_at,asc(按提交时间升序);默认 submit_at,desc
get_total_countinteger是否返回总数:1 返回,0 可跳过总数统计以提升性能。默认 1

filters 子字段说明

filters 为可选对象,可包含以下子字段,支持组合使用。

缺省范围说明:

  • filters 整体可省略;省略时,表示在当前 API Key 可见范围内查询记录,通常为当前企业范围内的记录。
  • 未传 filters.qrcode.id 时,表示不按二维码限制;如果仅传 filters.record_template.id,则表示查询该表单下的记录。
  • 未传 filters.record_template.id 时,表示不按表单限制;如果仅传 filters.qrcode.id,则表示查询该二维码下的记录。
  • 同时传 filters.qrcode.id + filters.record_template.id 时,表示查询“该二维码下、该表单产生的记录”,适合精确定位某个码上的某个表单记录。
  • 其他 filters.* 子字段与上述条件按组合条件共同生效。

filters.record_template

字段类型说明
idinteger表单模板 ID

filters.qrcode

字段类型说明
idinteger二维码 ID,支持单个
template_idinteger二维码模板 ID(批量模板码)
category_idinteger二维码分组 ID,支持单个

filters.project

字段类型说明
idinteger分区 ID

filters.audit

字段类型说明
stage_idinteger审核阶段 ID
statusinteger审核状态:0 待审核 / 1 审核通过 / 2 审核不通过;不传表示全部状态

filters.process_status

字段类型说明
textstring处理状态文本,精确匹配;可选值参考表单详情中的 process_status_config

filters.state_changes

字段类型说明
state_idinteger状态组 ID,筛选触发了该状态变更的记录

filters.recorder

字段类型说明
auth_idinteger填表人 auth_id(草料平台用户授权 ID)

返回格式概览

请求 formatdata.list[] 类型列表项内容来源适用场景
jsonobject获取单条记录format=jsondata.data 一致程序化解析、数据同步、字段级处理
json-ldobject获取单条记录format=json-lddata.data 一致语义化数据交换、知识图谱、语义检索
markdownstring获取单条记录format=markdowndata.data 一致阅读展示、归档导出、交给 LLM 做阅读类处理

配套资源:

完整返回示例

以下代码块展示三种 format 的成功响应骨架;完整 JSON 样例请使用上面的配套文件。

json
{
  "code": 0,
  "message": "ok",
  "data": {
    "list": [
      {
        "record_id": 1039879,
        "record_number": "L10610",
        "record_code": "ru6gdTee",
        "record_url": "https://qr46.cn/o4dilp/q0og7BW",
        "submit_at": 1763102668,
        "submit_at_iso": "2025-11-14 14:44:28(UTC+08:00)",
        "submit_method": "微信其他入口填写",
        "recorder": { "auth_id": 16559, "user_id": 831988, "name": "黄**" },
        "project": { "id": 329, "name": "演示会内容", "number": "F2" },
        "qrcode": { "id": 4698286, "name": "灭火器巡检", "type": 0, "type_text": "普通二维码" },
        "org": { "id": 94884306, "name": "南京噗噗网络科技有限公司765", "code": "o4dilp" },
        "record_template": { "id": 25732, "name": "灭火器巡检", "type": 0, "type_text": "普通表单", "number": "D510" },
        "audit": { "enabled": false, "current_stage_id": null, "status": null, "status_text": null },
        "process_status": { "enabled": false, "text": null, "color": null },
        "state_changes": [],
        "tpl_groups": [
          {
            "group_id": 27178,
            "group_title": "",
            "show_group_title": false,
            "is_page_break_group": false,
            "fields": [
              { "field_id": 153984, "field_title": "AI智能填表图片", "field_type": "image", "field_value": [{ "url": "https://ncstatic.clewm.net/rsrc/example.jpg" }] }
            ]
          }
        ]
      }
    ],
    "next_page_token": "CAESKAoVChMKD3JlY29yZF9hZGRfdGltZRAB...",
    "total": 36
  }
}
json
{
  "code": 0,
  "message": "ok",
  "data": {
    "list": [
      {
        "@context": "https://schema.org",
        "@type": "CreativeWork",
        "identifier": "ru6gdTee",
        "name": "灭火器巡检-L10610",
        "url": "https://qr46.cn/o4dilp/q0og7BW",
        "mainEntity": { "@type": "ItemList", "name": "组件数据" }
      }
    ],
    "next_page_token": "CAESKAoVChMKD3JlY29yZF9hZGRfdGltZRAB...",
    "total": 36
  }
}
json
{
  "code": 0,
  "message": "ok",
  "data": {
    "list": [
      "---\\ntitle: 灭火器巡检-L10610\\nrecord_id: 1039879\\n...\\n---\\n\\n# 灭火器巡检-L10610\\n\\n## 基本信息\\n\\n**记录编号:** L10610"
    ],
    "next_page_token": "CAESKAoVChMKD3JlY29yZF9hZGRfdGltZRAB...",
    "total": 36
  }
}

响应结构总览

路径类型说明
codeinteger平台状态码,0 表示成功
messagestring状态消息
dataobject业务响应包装层
data.listarray记录列表;元素类型由请求 format 决定
data.next_page_tokenstring下一页分页游标;无下一页时通常返回空字符串
data.totalinteger符合条件的记录总数;通常在 get_total_count=1 时返回准确统计值

列表项结构说明

getRecord 的复用关系

getRecords 不再额外定义一套独立的记录内容 schema。相同 format 下,data.list[] 中的每一项与 获取单条记录data.data 结构一致。

如果你在做程序接入或 agent 检索,建议先读取本页的列表层字段,再按 format 跳转到详情接口对应 schema 解析每个列表项。

补充说明:

  • format=json 时,data.list[] 中的每一项已经是完整记录详情对象;如果只是批量读取记录内容,通常不需要再逐条调用 获取单条记录
  • 获取单条记录 更适合以下场景:你已经拿到了单个 record_id / record_url,或只需要精确读取某一条记录。

推荐过滤策略

目标推荐参数
查询某个二维码下的全部记录filters.qrcode.id
查询某个二维码下某个表单的记录filters.qrcode.id + filters.record_template.id
查询某个表单在当前可见范围内的全部记录filters.record_template.id
在当前 API Key 可见范围内做全局记录检索可不传 filters.qrcode.idfilters.record_template.id,再按需叠加 search_key、时间范围或其他 filters.*

空列表示例

json
{
  "code": 0,
  "message": "ok",
  "data": {
    "list": [],
    "next_page_token": "",
    "total": 0
  }
}

其他字段约定

分页约定

场景说明
首次查询可不传 page_token
存在下一页将上一次响应中的 data.next_page_token 原样传回请求参数 page_token
无下一页data.next_page_token 通常为空字符串
是否继续翻页建议始终以 data.next_page_token 是否为空作为判断依据
get_total_count=0服务端可跳过总数统计以提升性能;此时不建议依赖 data.total 作为翻页终止条件

空值与脱敏约定

列表项中的空值、空数组、空字符串、关联对象为空值以及脱敏规则,与 获取单条记录 完全一致。

文档中链接到的示例文件均已做脱敏处理,仅用于结构说明与联调参考。

错误响应

失败时通常返回非成功状态,响应体可能包含以下字段:

json
{
  "code": 400,
  "error_code": 100300,
  "message": "System error",
  "message_detail": ""
}
字段类型说明
codeintegerHTTP 状态码或平台错误状态
error_codeinteger业务错误码
messagestring错误摘要
message_detailstring详细错误信息,可能为空字符串

具体错误码定义见:错误码说明