We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
Takashi Homma
2 years agoExplorer | Level 4
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 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.
Yes, to get information about a specific item, you would use /2/files/get_metadata.
4 Replies
- Greg-DB2 years ago
Dropbox Community Moderator
Yes, to get information about a specific item, you would use /2/files/get_metadata.
- Takashi Homma2 years agoExplorer | Level 4
I'll make 2 API requests.
- call to /2/files/get_metadata API with folder ID without Dropbox-API-Path-Root header
- if receive code 200 response, it means user folder.
- if receive code 409 response, then continue to next.
- call to /2/files/get_metadata API with same folder ID and Dropbox-API-Path-Root header
- if receive code 200 response, it means team folder.
Do you think this is appropriate workflow?
- call to /2/files/get_metadata API with folder ID without Dropbox-API-Path-Root header
- Здравко2 years agoLegendary | 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-DB2 years ago
Dropbox Community Moderator
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.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 11 hours ago
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 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!