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
craibuc
8 months agoExplorer | Level 3
Upload a file to a shared folder using the REST API
I'm attempting to upload a file to a shared (team) folder in Dropbox.
\ (hidden root)
\[My Personal Folder]
\My Company Team Folder
\Activities
\2024-04-11
File A
File B
I want to add files to \My Company Team Folder\Activities\2024-04-11.
This is the code (PowerShell):
$AccessToken = 'XXXXX'
$TeamMemberId = '123456' # an administrator
$InFile = ~/Desktop/SomeFile.pdf
$Destination = '/Activities/2024-04-11/SomeFile.pdf'
$Headers = @{
Authorization = 'Bearer {0}' -f $AccessToken
'Dropbox-API-Select-User' = $TeamMemberId
'Dropbox-API-Path-Root' = @{
'.tag'='root'
root=$RootFolderId
} | ConvertTo-Json -Compress
'Dropbox-API-Arg' = @{
path=$Destination
mode="add"
autorename=$true
mute=$false
} | ConvertTo-Json -Compress
}
$Response = Invoke-WebRequest -Method Post -Uri 'https://content.dropboxapi.com/2/files/upload' -Headers $Headers -ContentType 'application/octet-stream' -InFile $InFile
When I run the script, I get an error that reads "path/no_write_permission/".
- iNeilDropbox Engineer
Hello craibuc,
Based on the error message 'path/no_write_permission/', this indicates that you don’t have write permissions to the folder to upload the file. For example, you don’t have write permission to the folder /Activities/2024-04-11. Please double-check if you have editor permission on the folder.
If you are still having difficulty, could you provide the values for the $TeamMemberId and $RootFolderId? Alternatively, you can open an API ticket using the following link: https://www.dropbox.com/developers/contact- craibucExplorer | Level 3
I found the solution: I needed to include the team-folder's name in the path. So, instead of '/Activities/2024-04-11/SomeFile.pdf', it needed to be '/My Company Team Folder/Activities/2024-04-11/SomeFile.pdf'
The documentation on this is *terrible*, not to mention the contortions that developers need to perform to list shared folders and add content to them. Your API needs a complete revision to make it easier to use.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,888 PostsLatest Activity: 45 minutes agoIf 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!