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": "[email protected]", "[email protected]"},{"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:
Get Dropbox users (POST request): https://api.dropboxapi.com/2/team/members/list
Loop through each member and grab their team_member_id
For each member (currently 364 members) get all their folders and files recursively: https://api.dropboxapi.com/2/files/list_folder
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
If folder isn't shared then add folder to user object
If file check to see if user is owner of file: https://api.dropboxapi.com/2/sharing/list_file_members
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.