0

I'm trying to generate a nice big array for each user that contains all the files and folders the user owns as well as the users that each file/folder is shared with (e.g. users: ["John Doe": [{"name":"DemoDoc", "type": "file", "isShared": true, "sharedWithUsers": "bob@company.com", "joe@company.com"},{"name":"DemoFolder", "type": "folder", "isShared": false},...]]). I'll need to do this for a few hundred users. How should I do this with as few calls as possible?

The following is one approach per user:

  1. Get Dropbox users (POST request): https://api.dropboxapi.com/2/team/members/list

  2. Loop through each member and grab their team_member_id

  3. For each member (currently 364 members) get all their folders and files recursively: https://api.dropboxapi.com/2/files/list_folder

  4. For each member folder, if it's shared get the members and add folder to user object if user is the owner of shared folder: https://api.dropboxapi.com/2/sharing/list_folder_members

  5. If folder isn't shared then add folder to user object

  6. If file check to see if user is owner of file: https://api.dropboxapi.com/2/sharing/list_file_members

  7. If owner of file add file to user object

This approach could be thousands of http calls just for one user, which leads me to think this could be a very time expensive approach as well as the possibility of throttling.

Jono Suave
  • 101
  • 1
  • 5
  • Well fetch level 1 folder for all users, and maybe a function when you expand a folder then only fetch level 2 folder for that level 1 folder? If no API is provided to fetch all at once then its thousands of api calls and your client might be facing the throttling due to rate limiter. My suggestion is to Load level 1 folders or maybe just users, and when user is clicked then level 1 folder and when level 2 folder is clicked then its child folder (level 2). – Vikas Saini Dec 15 '22 at 15:35
  • [Cross-linking for reference: https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Retrieve-thousands-of-files-and-folders-without-throttling/td-p/644271 ] – Greg Dec 15 '22 at 16:30

0 Answers0