cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I would like to know whether the folder is under a team folder or a user folder

I would like to know whether the folder is under a team folder or a user folder

Takashi Homma
Explorer | Level 4

I would like to know whether the folder that specified in the Chooser widget is under a team folder or a user folder. Is there an appropriate API for this?

I guess it is available by folder id and get_metadata API.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff

Yes, to get information about a specific item, you would use /2/files/get_metadata.

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff

Yes, to get information about a specific item, you would use /2/files/get_metadata.

Takashi Homma
Explorer | Level 4

I'll make 2 API requests.

  1. call to /2/files/get_metadata API with folder ID without Dropbox-API-Path-Root header
    1. if receive code 200 response, it means user folder.
    2. if receive code 409 response, then continue to next.
  2. call to /2/files/get_metadata API with same folder ID and Dropbox-API-Path-Root header
    1. if receive code 200 response, it means team folder.

Do you think this is appropriate workflow?

Здравко
Legendary | Level 20

@Takashi Homma wrote:

I would like to know whether the folder that specified in the Chooser widget is under a team folder or a user folder. Is there an appropriate API for this?


Hi @Takashi Homma,

There is no direct API call that gives you that information. Once you get the file path (in the metadata) you can compare and see if is the residing place of the file in your (or your app' users) personal folder or no. You don't need other API calls - just literal comparison. If you don't have the home folder path yet, only getting metadata for the home folder itself may be needed (in such case you have to use Dropbox-API-Path-Root header) - executed single time.

A good way would be to review your application algorithm, so that can work without such information. Focus on data processing, not where the file(s) comes from - let the user controls this. 😉

Hope this gives direction.

Greg-DB
Dropbox Staff

@Takashi Homma Yes, additionally note that some teams currently have a team space, and some don't. Make sure to read through the Team Files Guide to understand how the different configurations work.

 

Also, note that there may be multiple reasons an endpoint would return a 409, so always check the error in the response body for the specific error case. You can find the errors for each endpoint in the endpoint documentation, such as for /2/files/get_metadata.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    Takashi Homma Explorer | Level 4
What do Dropbox user levels mean?