ファイルのコメントのリストを取得

get
https://api.box.com/2.0
/files/:file_id/comments

ファイルに関するコメントのリストを取得します。

リクエスト

application/json

パスパラメータ

stringパス内必須
12345

ファイルを表す一意の識別子。

ファイルIDを確認するには、ウェブアプリケーションでファイルにアクセスして、URLからIDをコピーします。たとえば、URLがhttps://*.app.box.com/files/123の場合、file_id123です。

クエリパラメータ

string arrayクエリ内省略可能
id,type,name

応答に含める属性のカンマ区切りリスト。このパラメータを使用すると、標準の応答には通常含まれないフィールドをリクエストできます。

このパラメータを指定すると、明示的に指定しない限り標準フィールドは応答に含まれず、リクエストしたフィールドのほかには、簡易版レプリゼンテーションのフィールドしか返されないことに注意してください。

integer / int64クエリ内省略可能
10001000

返す項目の1ページあたりの最大数。

integer / int64クエリ内省略可能
10000

応答が開始される項目のオフセット。

レスポンス

application/jsonComments

コメントオブジェクトのコレクションを返します。このファイルに関するコメントが存在しない場合は、空のコレクションが返されます。

予期しないクライアントエラー。

get
ファイルのコメントのリストを取得
このドキュメント内で一部のAPIを試せるようになりました。
ログイン

リクエストの例

cURL
curl -X GET https://api.box.com/2.0/files/12345/comments \
     -H 'Authorization: Bearer <ACCESS_TOKEN>'
Java
BoxFile file = new BoxFile(api, "id");
List<BoxComment.Info> comments = file.getComments();
Python
comments = client.file(file_id='11111').get_comments()
for comment in comments:
    print('Comment was left by {0} at {1}'.format(comment.created_by.name, comment.created_at))
Node
var fileID = '12345';
client.files.getComments(fileID)
    .then(comments => {
        /* comments -> {
            total_count: 1,
            entries: 
            [ { type: 'comment',
                id: '11111',
                is_reply_comment: false,
                message: 'Great work!',
                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' } ] }
        */
    });
iOS
client.files.listComments(forFile: "11111"){ results in
    switch results {
    case let .success(iterator):
        for i in 1 ... 10 {
            iterator.next { result in
                switch result {
                case let .success(comment):
                    print(comment.message)
                case let .failure(error):
                    print(error)
                }
            }
        }
    case let .failure(error):
        print(error)
    }
}