We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
dsoprea
2 years agoHelpful | Level 6
How to get account object for file uploader?
We have an app that's using team-scoped credentials. A particular file has a `modified_by` attribute that returns an account ID. We have a team-scoped resource (created by constructing a `DropboxTeam...
dsoprea
Helpful | Level 6
Thanks for responding, Greg-DB.
Yes. I'm aware. Dropbox doesn't [seemingly] provide an "uploader" attribute, so the modified-by attribute is all I have. With our usage, we can assume that all files are uploaded once, so it's equivalent.
There's a sizable amount of your response dedicate to selecting a member-ID, but all I have is an account ID. My hypothesis in the original post was that, in this case, perhaps the only way to get from an account ID to a member ID is by enumerating all members and filtering for account ID, though this is not ideal. It sounds like this is true?
Can you clarify your statement "The team_member_id you supply to as_user does not need to be for the same account as the account ID you supply to the users_get_account method."? I'm trying to get the user (and then the email) associated with the modified-by account ID. Why would I reference a different user/account/member than the one who modified the file?
Where would I get "individual account" credentials? Users themselves don't have API credentials, so maybe I'd need a second app that doesn't have team scopes from which to take credentials to do the non-team-scoped API requests from the same process as the existing requests, and switch between them as necessary?
Greg-DB
2 years agoDropbox Staff
dsoprea There are a number of different ways to get team member IDs, such as:
- like you mentioned, list the members of the team via team_members_list_v2 and team_members_list_continue_v2
- look up a specific member's information via team_members_get_info_v2
- check which team admin happened to authorize the particular access token being used via team_token_get_authenticated_admin
- retrieve the account information for an account, which includes the team member ID if the account happens to be on the same team, via the users_get_account method
The team member ID you supply to the as_user method tells the Dropbox API which team member you want to operate as. This is necessary for performing calls to user-endpoints, such as for the users_get_account method in the Python SDK. This can be any member of the team. Then, operating as that member, you can look up the account information of a different member, such as for whichever member happens to modify the file.
To avoid needing to use the as_user method, you can connect an app to a specific account instead of the entire team. In that case, the resulting access/refresh token would only have access to whatever information/functionality that particular account has access to. And since it's specific to that account already, you wouldn't need to use the as_user method. To do that, you would need to process the authorization without requesting any team scopes. One way to do that is to use an app registration without any team scopes enabled at all. That's not technically required though; an alternative way to do that is to just specify the desired subset of scopes (that is, only users scopes and no team scopes) at the time of authorization, which you can do by specifying the scopes in the 'scope' parameter on DropboxOAuth2Flow or DropboxOAuth2FlowNoRedirect, for example.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 5 hours agoIf 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 or Facebook.
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!