Forum Discussion

wojwal's avatar
wojwal
New member | Level 2
5 years ago

Best approach for Dropbox-API-Select-Admin for files endpoints using Team credentials for Business

Hi guys,

 

I'm currently integrating with Dropbox Business. I have Team credentials with "team_id"... And I don't want to work on behalf on specific user/admin. My main goal is actually to work with files (upload/download/rename/delete) that are in Team Folders - used and managed by different users/admins.

 

My dev business account is actually on Team Spaces, and I already know that I need to:

 - call team/namespaces/list - to get shared folders namespace ID

 - use Dropbox-API-Path-Root header to identity on which Team Folder root I want to work on

 

But additionally to work with files - I need to use User Endpoints - which requires me to use Dropbox-API-Select-Admin. I already know that I can call "team/members/list_v2" - and pick an admin account to be used on behalf with user endpoints. And this is where my doubts start.

 

1. I could leave it dynamic - and before any call to User Endpoints - I can always call "team/members/list_v2" - and just get first admin. I don't have to worry about storing/checking admin "member_id" - but I don't like to duplicate the amount of calls to API - before making a call to user endpoints I have to make another call to get admin member id. 

 

2. I could make a call once - and store/cache the admin member id - to reuse it in following calls. But in this case what would be best expiation timestamp to look for admin again - whatever it will be - what if cached admin account is downgraded to user or just leave the company... etc.. No matter if I re-check admin once per week, day or hour... In between the selected admin account might no longer be admin.

 

3. I can make it fixed - and just use 1'st admin, and if admin changes/leaves company - I will tell my customers that they need to refresh integration and pick another admin... I guess dummiest solution, since I can call "team/members/list_v2" myself - and this can be automated... Just writting it down, but definitelly not sth to use.

 

In my opinion the best option would be to use sth like "Dropbox-API-Select-Admin: Default" - but it doesn't exists.

 

What is the best or recommended approach in this situation?

 

1 Reply

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 years ago

    Dropbox doesn't have an official best practice/recommendation for this, nor a "Default" option like you described, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

     

    So, you can do whatever works best for your app. I suggest something like option 2, but instead of rechecking on a schedule, just catch the relevant error if/when the admin ID is no longer valid and then get a current admin ID and retry the call.

     

    Also, there is the /2/team/token/get_authenticated_admin endpoint to check which admin authorized a particular access token, so that may be a good value to start with.

About Dropbox API Support & Feedback

Node avatar for 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!