コレクション項目のリストを取得

get
https://api.box.com/2.0
/collections/:collection_id/items

このコレクションに含まれるファイルやフォルダを取得します。

リクエスト

Bearer [ACCESS_TOKEN]
application/json

パスパラメータ

stringパス内必須
"926489"

コレクションのID。

クエリパラメータ

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

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

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

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

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

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

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

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

レスポンス

application/jsonItems

コレクション内の項目の配列を返します。

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

get
コレクション項目のリストを取得
このドキュメント内で一部のAPIを試せるようになりました。
ログイン

リクエストの例

cURL
curl -i -X GET "https://api.box.com/2.0/collections/926489/items" \
     -H "Authorization: Bearer <ACCESS_TOKEN>"
.NET
BoxCollection<BoxItem> items = await client.CollectionsManager.GetCollectionItemsAsync(id: "11111");
Java
BoxFolder folder = new BoxFolder(api, "id");
for (BoxItem.Info itemInfo : folder) {
    if (itemInfo instanceof BoxFile.Info) {
        BoxFile.Info fileInfo = (BoxFile.Info) itemInfo;
        // Do something with the file.
    } else if (itemInfo instanceof BoxFolder.Info) {
        BoxFolder.Info folderInfo = (BoxFolder.Info) itemInfo;
        // Do something with the folder.
    }
}
Python
items = client.collection(collection_id='12345').get_items()
for item in items:
    print(f'{item.type.capitalize()} "{item.name}" is in the collection')
Node
client.collections.getItems('81934', {fields: 'name', limit: 2})
	.then(items => {
		/* items -> { total_count: 24,
			entries: 
			[ { type: 'folder',
				id: '192429928',
				sequence_id: '1',
				etag: '1',
				name: 'Stephen Curry Three Pointers' },
				{ type: 'file',
				id: '818853862',
				sequence_id: '0',
				etag: '0',
				name: 'Warriors.jpg' } ],
			offset: 0,
			limit: 2 }
		*/
	});

レスポンスの例

{
  "entries": [
    {
      "id": "12345",
      "etag": "1",
      "type": "file",
      "sequence_id": "3",
      "name": "Contract.pdf",
      "sha1": "85136C79CBF9FE36BB9D05D0639C70C265C18D37",
      "file_version": {
        "id": "12345",
        "type": "file_version",
        "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc"
      }
    }
  ],
  "limit": 1000,
  "offset": 2000,
  "order": [
    {
      "by": "type",
      "direction": "ASC"
    }
  ],
  "total_count": 5000
}