Forum Discussion

Anusha's avatar
Anusha
Explorer | Level 3
8 years ago

Trying to add group to the Team Folder using API

Hi,

I am trying to create a team folder and adding groups to it using API, Creating a team folder works fine, Then for adding groups to the folder, I could not find any API to do that. Can you please provide link to API if there is any?

 

Thanks,

Anusha

    • jason_nyc's avatar
      jason_nyc
      Explorer | Level 3

      I can't get this to work - I've tried everything to add a group to a team folder.  I've looked at other APIs and this is the only one that seems close to doing it.

      The AddMember selector mentions only the tags 'dropbox_id' and 'email'.  These are user selectors and not group selectors.  In the web gui, you aren't even allowed to add users to team folders - it must be a group.  

      I tried just passing a group_id tagged as 'group_id' but I get a 400:Bad Request error.

      I also tried passing a group_id tagged as a 'dropbox_id' but it didn't work either.

      $body_req = '{ "shared_folder_id": "4211433992", "members": [ { "member": {".tag": "group_id", "group_id": "g:22f456bfb335a64b000000000009f29e" }, "access_level": { ".tag": "editor"} }]}'

       

       

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        jason_nyc Using the group ID as a "dropbox_id" is the right way to add a group to a folder. 

        Here's an example of what that would look like:

        curl -X POST https://api.dropboxapi.com/2/sharing/add_folder_member \
            --header "Authorization: Bearer <TEAM_MEMBER_FILES_ACCESS_ACCESS_TOKEN>" \
            --header "Dropbox-API-Select-Admin: <ADMIN_MEMBER_ID>" \
            --header "Content-Type: application/json" \
            --data "{\"shared_folder_id\": \"<TEAM_FOLDER_ID>\",\"members\": [{\"member\": {\".tag\": \"dropbox_id\",\"dropbox_id\": \"g:53cf341b5cb2e387000000000000425a\"}}]}"

        Can you elaborate on what you mean when you say it didn't work? Please share the full code and output if something isn't working as expected. Make sure you check the response body for an error message.