We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

nsalex's avatar
nsalex
New member | Level 2
16 days ago

Unable to share folders since migration to updated team space

Back in June, our Dropbox Business account was migrated to the Updated Team Space system. We have a custom application that manages automatically uploading files and sharing folders with our customers. Everything was working fine prior to June, new files could be uploaded, folders could be shared, and folder members could be added. After the account was migrated, all of the functionality broke, as expected. We were able to fix file uploads by grabbing the new root_namespace_id for the account, but we have not been able to share folders since the account migration.

 

This is the response from the `get_features` endpoint for our account, which I believe indicates we are on the updated team space:

{
  "values": [
    {
      ".tag": "has_team_shared_dropbox",
      "has_team_shared_dropbox": {
        ".tag": "has_team_shared_dropbox",
        "has_team_shared_dropbox": false
      }
    },
    {
      ".tag": "has_distinct_member_homes",
      "has_distinct_member_homes": {
        ".tag": "has_distinct_member_homes",
        "has_distinct_member_homes": true
      }
    }
  ]
}

 

Here are the scopes granted to our application:

files.metadata.write
files.metadata.read
files.content.write
files.content.read
sharing.write
sharing.read
file_requests.write
file_requests.read
contacts.write
contacts.read

 

Here's an example of a file upload call that succeeds:

fetch('https://content.dropboxapi.com/2/files/upload', {
  method: 'POST',
  headers: {
   'Content-Type': 'application/octet-stream',
   'Dropbox-API-Arg': JSON.stringify({
     path: `/Client Files/${customer.name}/${file.name}`,
     mute: false,
    }),
   Authorization: `Bearer ${token}`,
   'Dropbox-API-Select-Admin': adminId,
   'Dropbox-API-Path-Root': JSON.stringify({
     '.tag': 'namespace_id',
     namespace_id: rootNamespaceId,
   }),
 },
 body: buffer,
}

 

However, after updating the share_folder call, we are getting {".tag": "no_permission"} responses. Here's how we are attempting to share new folders created by the app:

fetch('https://api.dropboxapi.com/2/sharing/share_folder', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
    'Dropbox-API-Select-Admin': adminId,
    'Dropbox-API-Path-Root': JSON.stringify({ '.tag': 'namespace_id', namespace_id: rootNamespaceId }),
  },
  body: JSON.stringify({
    path: `/Client Files/${customer.name}`,
    member_policy: 'anyone',
  }),
});

 

We've gone a few rounds trying different permutations of Dropbox-API-Select-Admin, Dropbox-API-Select-User, and Dropbox-API-Path-Root options, but we have had no luck.

 

I don't know if this matters, but here's the metadata for the "/Client Files" folder: 

{
  ".tag": "folder",
  "name": "Client Files",
  "path_lower": "/client files",
  "path_display": "/Client Files",
  "parent_shared_folder_id": "<root namespace id>",
  "id": "id:<id>",
  "shared_folder_id": "<number>",
  "sharing_info": {
    "read_only": false,
    "parent_shared_folder_id": "<root namespace id>",
    "shared_folder_id": "<number>",
    "traverse_only": false,
    "no_access": false
  }
}

 

  • Hi nsalex,

     

    Since you are using the rootNamespaceId, we recommend using { '.tag': 'root', 'root': rootNamespaceId } instead of { '.tag': 'namespace_id', namespace_id: rootNamespaceId } in your request. This aligns with the naming structure and value expected by the API, thus ensuring correct functionality.

  • DB-Des's avatar
    DB-Des
    Icon for Dropbox Engineer rankDropbox Engineer

    Hi nsalex,

     

    Since you are using the rootNamespaceId, we recommend using { '.tag': 'root', 'root': rootNamespaceId } instead of { '.tag': 'namespace_id', namespace_id: rootNamespaceId } in your request. This aligns with the naming structure and value expected by the API, thus ensuring correct functionality.

    • nsalex's avatar
      nsalex
      New member | Level 2

      Thank you! Unlike the "files/upload" endpoint, the namespace_id and root tags behave differently for the root namespace in the "sharing/share_folder" endpoint. This is now working.