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

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

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

リクエスト

bearer [ACCESS_TOKEN]
application/json

パスパラメータ

stringパス内必須
12345

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

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

クエリパラメータ

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

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

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

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

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

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

レスポンスが開始される項目のオフセット。

オフセットパラメータ値が10,000を超えているクエリは拒否され、400レスポンスが返されます。

レスポンス

application/jsonComments

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

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

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

リクエストの例

cURL
curl -i -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(f'Comment was left by {comment.created_by.name} at {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
let iterator = client.files.listComments(forFile: "11111")
iterator.next { results in
    switch results {
    case let .success(page):
        for comment in page.entries {
            print(comment.message)
        }

    case let .failure(error):
        print(error)
    }
}

レスポンスの例

{
  "entries": [
    {
      "id": "11446498",
      "type": "comment",
      "is_reply_comment": true,
      "message": "@Aaron Levie these tigers are cool!",
      "created_by": {
        "id": "11446498",
        "type": "user",
        "name": "Aaron Levie",
        "login": "ceo@example.com"
      },
      "created_at": "2012-12-12T10:53:43-08:00",
      "modified_at": "2012-12-12T10:53:43-08:00",
      "item": {
        "id": "11446498",
        "type": "file"
      },
      "tagged_message": "@[1234567:Aaron Levie] these tigers are cool!"
    }
  ],
  "limit": 1000,
  "offset": 2000,
  "order": [
    {
      "by": "type",
      "direction": "ASC"
    }
  ],
  "total_count": 5000
}