List Items in Collections

Guides Collections List Items in Collections
Edit this page

List Items in Collections

To list all files, folders and web links in a folder call the GET /collections/:id/items API.

cURL
curl -i -X GET "https://api.box.com/2.0/collections/926489/items" \
     -H "Authorization: Bearer <ACCESS_TOKEN>"
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('{0} "{1}" is in the collection'.format(item.type.capitalize(), item.name))

The only collection that is available via the API is the "Favorites" collection. The ID of this collection is different for every user.