文档划词 / 单元格评论
评论是依附于文档内具体的内容的评论,当内容被删除时,评论也会被删除。
获取评论列表
接口
GET <SHIMO_API>/files/<GUID>/comments
鉴权信息
参数 | 说明 |
---|---|
scope | "read" |
info.fileGuid | <GUID> |
info.filePermissions.readonly | true |
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
context | boolean | N | 是否返回评论相关的上下文,包括所在段落和评论的原内容。暂只有最新版本的私有部署中可用。 |
代码示例
const request = require('node-fetch')
fetch('<SHIMO_API>/files/JyRX1679PL86rbTk/comments', {
method: 'GET',
headers: {
Authorization: 'Bearer <Access Token>',
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(body => console.log(body.data))
返回示例
{
"data": [{
"commentGuid": "43apeltp1CATJF6f",
"isDelete": 0,
"selectionGuid": "comment-a2aCRQBPheIVIHhe",
"selectionTitle": "",
"targetGuid": "JyRX1679PL86rbTk",
"targetId": 32347865,
"targetType": 1,
"userId": 4069620,
"updatedAt": "2018-05-29T09:07:51.000Z",
"createdAt": "2018-05-29T09:07:51.000Z",
"id": 17683794,
"content": "hello world",
"hasRead": true,
"paragraph": "",
"selection": ""
}],
"code": 0
}
获取划词评论的评论列表
接口
GET <SHIMO_API>/files/<GUID>/comments/:selectionGuid
鉴权信息
参数 | 说明 |
---|---|
scope | "read" |
info.fileGuid | <GUID> |
info.filePermissions.readonly | true |
代码示例
const request = require('node-fetch')
fetch('<SHIMO_API>/files/JyRX1679PL86rbTk/comments/comment-a2aCRQBPheIVIHhe', {
method: 'GET',
headers: {
Authorization: 'Bearer <Access Token>',
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(body => console.log(body.data))
返回示例
{
"data": [{
"commentGuid": "43apeltp1CATJF6f",
"isDelete": 0,
"selectionGuid": "comment-a2aCRQBPheIVIHhe",
"selectionTitle": "",
"targetGuid": "JyRX1679PL86rbTk",
"targetId": 32347865,
"targetType": 1,
"userId": 4069620,
"updatedAt": "2018-05-29T09:07:51.000Z",
"createdAt": "2018-05-29T09:07:51.000Z",
"id": 17683794,
"content": "hello world",
"hasRead": true
}],
"code": 0
}
删除评论
接口
DELETE <SHIMO_API>/files/<GUID>/comments/:commentGuid
鉴权信息
参数 | 说明 |
---|---|
scope | "write" |
info.fileGuid | <GUID> |
info.filePermissions.editable | true |
代码示例
const request = require('node-fetch')
fetch('<SHIMO_API>/files/JyRX1679PL86rbTk/comments/3YqYN0QJFFRTss3J', {
method: 'POST',
headers: {
Authorization: 'Bearer <Access Token>',
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(body => console.log(body.data))
返回示例
{
"data": {
"commentGuid": "3YqYN0QJFFRTss3J",
"isDelete": 0,
"selectionGuid": "comment-a2aCRQBPheIVIHhe",
"selectionTitle": "",
"targetGuid": "JyRX1679PL86rbTk",
"targetId": 32347865,
"targetType": 1,
"userId": 4069620,
"updatedAt": "2018-05-29T09:40:01.000Z",
"createdAt": "2018-05-29T09:40:01.000Z",
"id": 17684337,
"content": "Yay"
},
"code": 0
}
关闭评论
接口
DELETE <SHIMO_API>/files/<GUID>/comments/close/:selectionGuid
该接口会批量删除该划词评论中所有评论
鉴权信息
参数 | 说明 |
---|---|
scope | "write" |
info.fileGuid | <GUID> |
info.filePermissions.editable | true |
代码示例
const request = require('node-fetch')
fetch('<SHIMO_API>/files/JyRX1679PL86rbTk/comments/close/comment-a2aCRQBPheIVIHhe', {
method: 'DELETE',
headers: {
Authorization: 'Bearer <Access Token>',
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(body => console.log(body.data))
返回示例
{
"data": [1],
"code": 0
}