文档历史
此历史包含的是对文档操作的历史,比如创建、重命名、内容修改和分享等。
获取历史列表
接口
GET <SHIMO_API>/files/<GUID>/histories
鉴权信息
参数 | 说明 |
---|---|
scope | "read" |
info.fileGuid | <GUID> |
info.filePermissions.readonly | true |
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
size | Number | N | 返回的历史条数,默认 10 |
historyType | Number | N | history type 类型 |
order | String | N | 排序方式,默认 desc |
sort | String | N | 排序字段,默认 createdAt |
page | Number | N | 查询的页码,默认 0 |
count | Number | N | 跳过多少个记录,默认 0 ,count: 30 等同于 page: 1, size: 30 。count 存在时 page 将被忽略。deprecated |
size | Number | N | 返回多少结果,别名为 pageSize ,默认 30 |
content | string | N | 返回历史内容的格式,为空时返回石墨格式,为 plain 时返回纯文本格式 |
代码示例
const request = require('node-fetch')
fetch('<SHIMO_API>/files/JyRX1679PL86rbTk/histories', {
method: 'GET',
headers: {
Authorization: 'Bearer <Access Token>',
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(body => console.log(body.data))
返回示例
{
"histories": [{
"fileGuid": "JyRX1679PL86rbTk",
"historyType": 1,
"userId": "10676",
"updatedAt": "2018-05-29T09:07:51.000Z",
"createdAt": "2018-05-29T09:07:51.000Z",
"id": 434594,
"content": "{\"action\":\"create\"}"
}],
"isLastPage": false,
"guid": "JyRX1679PL86rbTk",
"users": { "1": "shimo" },
"limit": null
}
获取历史
接口
GET <SHIMO_API>/files/<GUID>/histories/:id
鉴权信息
参数 | 说明 |
---|---|
scope | "read" |
info.fileGuid | <GUID> |
info.filePermissions.readonly | true |
代码示例
const request = require('node-fetch')
fetch('<SHIMO_API>/files/JyRX1679PL86rbTk/histories/434594', {
method: 'GET',
headers: {
Authorization: 'Bearer <Access Token>',
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(body => console.log(body.data))
返回示例
{
"fileGuid": "JyRX1679PL86rbTk",
"historyType": 1,
"userId": "10676",
"updatedAt": "2018-05-29T09:07:51.000Z",
"createdAt": "2018-05-29T09:07:51.000Z",
"id": 434594,
"content": "{\"action\":\"create\"}"
}