我在 Box 中有一个使用 Box Api 注释文件的场景。我已经使用 Box api 添加评论。当显示所有评论时,它显示所有评论的评论者姓名相同。
我应该如何添加评论来区分谁使用 Box API 发表了评论
评论列表示例:
{
"type": "comment",
"id": "1111",
"is_reply_comment": false,
"message": "Sample Comment 1",
"created_by": {
"type": "user",
"id": "111",
"name": "AAA",
"login": "aaa@aaa.com"
},
"created_at": "2016-08-11T00:01:56-07:00",
"item": {
"id": "78110824178",
"type": "file"
},
"modified_at": "2016-08-11T00:01:56-07:00"
}
{
"type": "comment",
"id": "2222",
"is_reply_comment": false,
"message": "Sample Comment 2",
"created_by": {
"type": "user",
"id": "111",
"name": "AAA",
"login": "aaa@aaa.com"
},
"created_at": "2016-08-11T00:01:56-07:00",
"item": {
"id": "78110824178",
"type": "file"
},
"modified_at": "2016-08-11T00:01:56-07:00"
}
请帮忙添加针对不同用户的评论
最佳答案
要以特定用户的身份发表评论,您可以使用 As-User header 。这是一个例子:
curl https://api.box.com/2.0/comments \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "As-User: USER_ID" \
-d '{"item": {"type": "file", "id": "FILE_ID"}, "message": "YOUR_MESSAGE"}' \
-X POST
关于node.js - Box Api - 如何获取评论文件的用户详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38890695/