Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Ashley B.15
10 years agoHelpful | Level 7
https://api.dropboxapi.com/2/sharing/list_folders should return all folders user can access?
Hi,
I've been looking at the below endpoint, forgive me if this is a silly question. Should this return all folders I can access in the dropbox ui?
https://api.dropboxapi.com/2/sharing/list_folders
I'm making a request to a users Dropbox using this header Dropbox-API-Select-User with the user id. This works with out any problems when I'm listing users files and folders.
When I do the following with sharing/list_folders it does not appear to bring all the folders. For example say I'm doing Dropbox-API-Select-User say on User 1.
User 2 has created a folder called "FOLDER" and shared this folder with User 1 and another, User 3.
"FOLDER" has a sub folder called "SUB FOLDER" which was created by User 3.
I can view these folders and upload to "SUB FOLDER" I've not set any limits for the request and there are only a few folders and files.
Am I missing something?
8 Replies
- Ashley B.1510 years agoHelpful | Level 7
Just to confirm.when making a request with Dropbox-API-Select-User, it does not appear to list all the folders that user can access
- Greg-DB10 years ago
Dropbox Community Moderator
Hi Ashley, the /sharing/list_folders[/continue] endpoints should list all of the shared folders the specified user has access to. In your example, is "FOLDER" missing, or is it only "SUB FOLDER" that you're expecting and not seeing?
The endpoint wouldn't list the subfolders (e.g., "SUB FOLDER") or other contents of those shared folders, in case that's what you mean (since the subfolders aren't themselves shared folders, but are just in shared folders). You'd have to then call /files/list_folder[/continue] for each shared folder you want, if so.
Also, make sure you always check for a cursor in the response. If there is one, it indicates that there are more shared folders to return, and you should call /sharing/list_folders/continue to get them.
In any case, if you're still seeing issues with this, please share some sample code and output to help illustrate it.
- Ashley B.1510 years agoHelpful | Level 7
Hi.
I'm expecting to see the "SUB FOLDER" in the endpoint as I can access/upload through the API. I did notice that "SUB FOLDER" had no "SharedFolderId" but a "ParentSharedFolderId" this would make sense. As you say its not a shared folder but in a shared folder. I think the description for this endpoint might be a bit misleading?
This is a shared folder which inherits its permissions from its parent? I would expect to see it in the endpoint
Thanks
- Greg-DB10 years ago
Dropbox Community Moderator
I see, thanks for clarifying. The /sharing/list_folders endpoint isn't supposed to list "SUB FOLDER" in that case, as that is just a normal folder inside a shared folder, and not a shared folder itself.
You can use /files/list_folder[/continue] to list the contents of "FOLDER".
- Inderjeetdev3 years agoHelpful | Level 5
As mentioned in https://www.dropbox.com/developers/documentation/http/documentation#sharing-list_folders , API: https://api.dropboxapi.com/2/sharing/list_folders should return cursor variable, so that I can use it in https://api.dropboxapi.com/2/sharing/list_folders/continue API to get sub-folders, however https://api.dropboxapi.com/2/sharing/list_folders is not returning cursor variable in response. How do I get get cursor variable?
- Greg-DB3 years ago
Dropbox Community Moderator
Inderjeetdev The cursor field will be "Present if there are additional shared folders that have not been returned yet.". If the cursor is not returned, that means that there are no more shared folders to return, and so it is not necessary to call /2/sharing/list_folders/continue.
Also, note that the /2/sharing/list_folders[/continue] endpoints only return shared folders themselves, not the contents of shared folders. To list all of the contents of any particular folder, you would use /2/files/list_folder[/continue] instead.
- Inderjeetdev3 years agoHelpful | Level 5
Greg-DB There are still sub-sub-folders inside the shared folder which are not returned by the API https://api.dropboxapi.com/2/sharing/list_folders . I can access sub-sub-folders by direct link, so it means they are shared to me, API is not fetching them (it fetched only two sub-folders) however as you mentioned that this API only return shared folders themselves, not the contents of shared folders, so, I can ignore it for now because I need file names.
Main issue is that if I depend on https://api.dropboxapi.com/2/files/list_folder , it needs 'Dropbox-API-Select-User', so it don't allow to access shared team folder outside a user's folder. How do I access them through API?
- Здравко3 years agoLegendary | Level 20
Inderjeetdev wrote:...
Main issue is that if I depend on https://api.dropboxapi.com/2/files/list_folder , it needs 'Dropbox-API-Select-User', so it don't allow to access shared team folder outside a user's folder. How do I access them through API?
Hi Inderjeetdev,
Yes, you are correct. Take a look on the discussion here, so I not to repeat everything again. 😉
Good luck.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!