Dropbox API v2 files_list_folder

2019-09-11 05:55发布

问题:

Looking at the list_folder sandbox at dropbox.github.io/dropbox-api-v2-explorer/#files_list_folder

  1. I find no way to just return just the folders - basically where ".tag" = "folder" - I get all folders and files in one huge hunk the have to parse out the "folders"

  2. There is no way to easily parse the nested folders into some logical way so I can display a list with the sub folders indented in a display. such as Parent ID's would be helpful to match up children & parent folders

  3. no sorting features, such as 'name' 'created' to return them in name or created ASC/DESC order

Any help?

回答1:

Best solution I could come up with to get only the folders back was this. It seems that when you perform a "2/files/list_folder" for a specific "path" and set all options to false. When you receive data back, iterate through the looking for .tag == "folder" and collect them. If you find an item that is not .tag == "folder", you can stop, you've collected all the folders for you specified "path". No need to perform a "2/files/list_folder/continue". Though it doesn't solve all my issues, this certainly goes a long way to solving my loading/searching time for folders.