box api - Box.com Search API to retrieve all files in a determined folder -
i'm searching way obtain files of specific folder.
but can't find sufficient informations in official documentation
i think this: (i assume set custom header access_token)
https://api.box.com/2.0/search?query=*
this way doesn't work, , think query doen't accept regex...
any idea?
ps: real usecase understand question:
my folder:
folderone: | |_file1.jpg | |_file2.doc | |_folder1 | |_file3.jpg | |_folder2 | |_file4.pdf
with search request expect file1.jpg
, file2.doc
, file4.pdf
.
you can accomplish querying folder's contents , filtering client-side file
items.
curl https://api.box.com/2.0/folders/folder_id/items \ -h "authorization: bearer access_token"
this return collection of items, can select type
file
.
{ "total_count": 4, "entries": [ { "type": "folder", "id": "192429928", "name": "folder1" }, { "type": "file", "id": "818853862", "name": "file1.jpg" }, { "type": "file", "id": "818853843", "name": "file2.doc" }, { "type": "file", "id": "818853832", "name": "file4.pdf" } ] }
pagination
box return folder metadata before file metadata. can count these folders determine appropriate offset file-only paging. example, if box folder has 13 subfolders, , want page 25 files @ time:
/folders/folder_id/items?limit=25&offset=13 /folders/folder_id/items?limit=25&offset=38 /folders/folder_id/items?limit=25&offset=63 /folders/folder_id/items?limit=25&offset=...
Comments
Post a Comment