You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

slowdolphin's avatar
slowdolphin
Explorer | Level 3
6 years ago

Try to Share a Sub-Folder of a Team Folder using API

I can share a Shared folder to a member using

https://api.dropboxapi.com/2/sharing/add_folder_member
Data: {
    "shared_folder_id": "xxxxxxxxx",
    "members": [{
            "member": {
                ".tag": "email",
                "email": "mymail"
            },
            "access_level": "viewer"
        }],
    "quiet": false,
    "custom_message": "Documentation for launch day"
}

 

But I wanted to Share a Sub-Folder to a specific group of internal user so I created a Team Folder to do that.
However I am not sure which api I can call to assign a group to a sub folder under Team Folder.
Can someone please help me out here? I have Business Advance Account.

  • If you've already created the team folder, you can then share a sub folder under it using /2/sharing/share_folder, and then add the group as a member using /2/sharing/add_folder_member.

    That would look like this:

    curl -X POST https://api.dropboxapi.com/2/sharing/share_folder \
        --header "Authorization: Bearer <ACCESS_TOKEN>" \
        --header "Dropbox-API-Select-Admin: <ADMIN_MEMBER_ID>" \
        --header "Content-Type: application/json" \
        --data "{\"path\": \"ns:<TEAM_FOLDER_ID>/<SUBFOLDER_NAME>\"}"
    
    curl -X POST https://api.dropboxapi.com/2/sharing/add_folder_member \
        --header "Authorization: Bearer <ACCESS_TOKEN>" \
        --header "Dropbox-API-Select-Admin: <ADMIN_MEMBER_ID>" \
        --header "Content-Type: application/json" \
        --data "{\"shared_folder_id\": \"<SHARED_FOLDER_ID>\",\"members\": [{\"member\": {\".tag\": \"dropbox_id\",\"dropbox_id\": \"<GROUP_ID>\"}}]}"
    
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    If you've already created the team folder, you can then share a sub folder under it using /2/sharing/share_folder, and then add the group as a member using /2/sharing/add_folder_member.

    That would look like this:

    curl -X POST https://api.dropboxapi.com/2/sharing/share_folder \
        --header "Authorization: Bearer <ACCESS_TOKEN>" \
        --header "Dropbox-API-Select-Admin: <ADMIN_MEMBER_ID>" \
        --header "Content-Type: application/json" \
        --data "{\"path\": \"ns:<TEAM_FOLDER_ID>/<SUBFOLDER_NAME>\"}"
    
    curl -X POST https://api.dropboxapi.com/2/sharing/add_folder_member \
        --header "Authorization: Bearer <ACCESS_TOKEN>" \
        --header "Dropbox-API-Select-Admin: <ADMIN_MEMBER_ID>" \
        --header "Content-Type: application/json" \
        --data "{\"shared_folder_id\": \"<SHARED_FOLDER_ID>\",\"members\": [{\"member\": {\".tag\": \"dropbox_id\",\"dropbox_id\": \"<GROUP_ID>\"}}]}"
    

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 4 days ago
333 Following

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!