仅将文件从GET文件夹请求检索到Box.com [英] Retrieve only file from GET folder request to Box.com

查看:99
本文介绍了仅将文件从GET文件夹请求检索到Box.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只需要从Box.com的GET请求中检索文件。

I need retrieve only file from a GET request to Box.com.

问题如下:
我有一个显示面板的地方文件内容放在一个文件夹中。

当前,我获得了所有内容,并且仅保留类型等于 file的元素。

Problem is the follow... I have a Panel where I show the files contents in a folder.
Currently I get all the content and I keep only the elements that have type equals to "file".

现在我需要对结果进行分页。我使用Box API以这种方式获取结果的偏移量:

Now I need to paginate the results. I use the Box API to get an offset of result, in this way:

GET https://api.box.com/2.0/folders/0/items?limit=2&offset=1
Authorization: Bearer MY_TOKEN

我要求拳头2个要素。但是很显然,如果前两个元素都是文件夹,那么我的面板将显示零个元素。

I ask for the fist 2 elements. But is obviously that if the first 2 elements is both folder, my panel will show zero elements.

是否可以通过GET请求指定元素的类型?像这样的东西:

Is there a way to make a GET request specifying the type of the elements? something like this:

GET https://api.box.com/2.0/folders/0/items?limit=2&offset=1&type=file
Authorization: Bearer MY_TOKEN


推荐答案

您可能需要使用Search API: http://developers.box。 com / docs /#search

You'll want to probably use the Search API: http://developers.box.com/docs/#search

它可让您指定type = file并仅获取文件。但是,它以递归方式进入所有子目录,因此它可能无法完全提供您要查找的内容。如果您仅查找顶级目录和仅文件,则必须在API响应后在自己的一侧进行过滤。使用GET ./folders//items并对所有项目进行分页,丢弃所有type = folders项目。

It lets you specify type=file and get only files. However it goes into all the sub-directories recursively, so it may not provide exactly what you are looking for. If you are looking for only the top-level directory and files-only, then you'll have to do the filtering on your side after the API response. Use GET ./folders//items and paginate through all the items, throwing away all the type=folders items.

这篇关于仅将文件从GET文件夹请求检索到Box.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆