ユーザーによるコメントを特定のファイルに追加するか、 他のコメントへの返信としてコメントを追加します。
id,type,name
応答に含める属性のカンマ区切りリスト。このパラメータを使用すると、標準の応答には通常含まれないフィールドをリクエストできます。
このパラメータを指定すると、明示的に指定しない限り標準フィールドは応答に含まれず、リクエストしたフィールドのほかには、簡易版レプリゼンテーションのフィールドしか返されないことに注意してください。
コメントを追加する項目。
11446498
項目のID
file
このコメントが追加される項目の種類。
次の値のいずれか1つ: file
,comment
Review completed!
コメントのテキスト。
特定のユーザーにメンションするには、
代わりにtagged_message
パラメータを使用します。
@[1234:John] Review completed!
メッセージ内のどこかで@[user_id:name]
を使用して他のユーザーにメンションしているコメントのテキスト。メンションされたユーザーには、メンションされたことを知らせるメール通知が送信されます。
user_id
はターゲットユーザーのIDで、name
には任意のカスタムフレーズを使用できます。Box UIでは、この名前がユーザーのプロフィールにリンクされます。
他のユーザーにメンションしていない場合は、代わりにmessage
を使用します。
curl -X POST https://api.box.com/2.0/comments \
-H 'Authorization: Bearer <ACCESS_TOKEN>" '
-H 'Content-Type: application/json" '
-d '{
"message": "Review completed!",
"item": {
"type": "file",
"id": 426436
}
}'
var requestParams = new BoxCommentRequest()
{
Item = new BoxRequestEntity()
{
Type = BoxType.File,
Id = "12345"
},
Message = "Great work!"
};
BoxComment comment = await client.CommentsManager.AddCommentAsync(requestParams);
BoxFile file = new BoxFile(api, "id");
file.addComment("This file is pretty cool.");
comment = client.file(file_id='11111').add_comment('When should I have this done by?')
client.comments.create('33333', 'Is this the latest version?')
.then(comment => {
/* comment -> {
type: 'comment',
id: '11111',
is_reply_comment: false,
message: 'Is this the latest version?',
created_by:
{ type: 'user',
id: '22222',
name: 'Example User',
login: 'user@example.com' },
created_at: '2012-12-12T11:25:01-08:00',
item: { id: '33333', type: 'file' },
modified_at: '2012-12-12T11:25:01-08:00' }
*/
});
client.comments.create(
itemId: "11111",
itemType: "file",
message: "Thanks!"
) { (result: Result<Comment, BoxSDKError>) in
guard case let .success(comment) = result else {
print("Error creating comment")
return
}
print("Added comment to \(comment.item.name): \"\(comment.message)\"")
}