我在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"
}
请帮助为不同的用户添加评论
答案 0 :(得分:1)
要以特定用户身份发表评论,您可以使用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