cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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:Ā 

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

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

slowdolphin
Explorer | Level 3
Go to solution

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.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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>\"}}]}"

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

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>\"}}]}"

slowdolphin
Explorer | Level 3
Go to solution

Thank you .....thats works perfectly

Need more support?