获取与文件相关的文件列表
开发中GET
{endpoint_url}/search/files/recent此接口用于 @ 功能文件补全。 在文件中输入 @ 时,展示下拉菜单,选择提及的文件,接入方可根据自己系统情况返回,例如:和当前用户最相关的文件列表、和当前文件最相关的文件列表、或返回空数组。
支持返回 @ 第三方文件
:::caution 说明
由于第三方文件无法进行协作,仅支持在 SDK 中插入 @ 时保留引用,因此需要达到点击后跳转至第三方页面,需要满足以下条件:
file 信息
type
字段值为file
,参考如下 Response Body Example。file 信息增加
fullUrl
字段作为跳转至接入方系统的完整地址,参考如下 Response Body Example。前端使用
shimo-js-sdk
时在调用connect
需要实现openLink
方法用于控制编辑器内点击链接时的跳转行为。
:::
请求参数
Path 参数
endpoint_url
string
必需
示例值:
{{endpoint_url}}
Query 参数
fileId
string
必需
表示当前查询来自接入方的某个文件 ID
示例值:
file12345
Header 参数
X-Shimo-Token
string
必需
用于接入方对本次请求鉴权
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
array of:
id
string
必需
接入方系统中的文档 ID
name
string
文档标题
type
string
必需
文档类型列表参考 创建文档,若为第三方存储的非石墨协作文件,则固定传 file
permissions
object
必需
请参考 文件权限说明
commentable
boolean
必需
editable
boolean
必需
readable
boolean
必需
creatorId
string
必需
接入方文件的创建者用户 ID
createdAt
string
必需
接入方记录的文件创建时间,UTC
时间(0 时区), 格式为 2022-01-01T09:00:01Z
updatedAt
string
必需
接入方记录的文件最后更新时间,UTC
时间(0 时区), 格式为 2022-01-01T09:00:01Z
views
number
必需
接入方统计的文件阅读次数,用于在文档信息中展示阅读次数。若接入方未返回,则默认显示为 1
fullUrl
string
访问文件的完整地址
示例
[
{
"id": "ba13551165cc5066",
"name": "示例表格",
"type": "spreadsheet",
"permissions": {
"commentable": true,
"editable": false,
"readable": true
},
"creatorId": "1",
"createdAt": "2021-08-01T00:00:00Z", // UTC 时间,0 时区,在北京时间基础上减 8 小时
"updatedAt": "2021-08-02T00:00:00Z", // UTC 时间,0 时区,在北京时间基础上减 8 小时
"views": 100
},
{
"id": "ba13551165cc5066",
"name": "示例文档",
"type": "document",
"permissions": {
"commentable": true,
"editable": false,
"readable": true
},
"creatorId": "1",
"createdAt": "2021-08-01T00:00:00Z", // UTC 时间,0 时区,在北京时间基础上减 8 小时
"updatedAt": "2021-08-02T00:00:00Z", // UTC 时间,0 时区,在北京时间基础上减 8 小时
"views": 100
},
{
"id": "ba13551165cc5066",
"name": "接入方自己的文件.docx",
"type": "file",
"permissions": {
"commentable": false,
"editable": false,
"readable": true
},
"creatorId": "1",
"createdAt": "2021-08-01T00:00:00Z", // UTC 时间,0 时区,在北京时间基础上减 8 小时
"updatedAt": "2021-08-02T00:00:00Z", // UTC 时间,0 时区,在北京时间基础上减 8 小时
"views": 0,
"fullUrl": "https://customer-system.com/path/to/file" // 仅在文件仅为接入方自身系统的文件而非协同文档时需要传递
}
]
最后修改时间: a year ago