Box Api – 如何获取谁评论一个文件的用户细节

我有Box 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标头 。 这里是一个例子:

 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 
Interesting Posts