We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

Takashi Homma's avatar
Takashi Homma
Explorer | Level 4
2 years ago
Solved

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.

4 Replies

  • Takashi Homma's avatar
    Takashi Homma
    Explorer | Level 4
    2 years ago

    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?

  • Здравко's avatar
    Здравко
    Legendary | Level 20
    2 years ago

    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's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    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

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 11 hours ago
411 Following

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!