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

dc_ucw's avatar
dc_ucw
New member | Level 2
7 years ago

File upload 409 Conflict "path/no_write_permission" to team space

Getting an 409 Conflict  "path/no_write_permission" to team space when trying to upload a file.    Where do I set team space folder persmissions for an app?

Here is the code (powershell):

$DonToken = 'zzzzzzzz'
$NameSpaceId = "9999999999"
$TargetFileDir = "ns:" + $NameSpaceId + "/TEAM1/TestDeploy/" $InputZipPath = 'c:\temp\TestPushToDropBox.zip' $ZipFileName = "TestPushToDropBox.zip" $arg = '{ "path": "' + $TargetFileDir + $ZipFileName + '", "mode": "add", "autorename": true, "mute": false }' $authorization = "Bearer " + $Token $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $headers.Add("Authorization", $authorization) $headers.Add("Dropbox-API-Arg", $arg) $headers.Add("Content-Type", 'application/octet-stream') # $nshead = '{".tag": "namespace_id", "namespace_id": $NameSpaceId}' # $headers.Add("Dropbox-API-Path-Root", $nshead) $resp = try { Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $InputZipPath -Headers $headers } catch { $_.Exception.Response } write-host $resp.StatusCode.value__ write-host $resp.StatusCode write-host $resp.StatusDescription




  • To access the team space itself, you need to set your "root" to the team space using the "Dropbox-API-Path-Root" header, instead of specifying the namespace ID in the path value as you're trying to do in this code. 

    You can find information setting "root" in "Dropbox-API-Path-Root" in the Namespace Guide.

    It looks like you have part of this commented out already. Re-enable that, and use "root" instead of "namespace_id", and remove the "ns:..." usage from your "path" value.

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

    To access the team space itself, you need to set your "root" to the team space using the "Dropbox-API-Path-Root" header, instead of specifying the namespace ID in the path value as you're trying to do in this code. 

    You can find information setting "root" in "Dropbox-API-Path-Root" in the Namespace Guide.

    It looks like you have part of this commented out already. Re-enable that, and use "root" instead of "namespace_id", and remove the "ns:..." usage from your "path" value.

    • dc_ucw's avatar
      dc_ucw
      New member | Level 2

      Greg - thanks for the quick reply.    I have tried your suggestion, but now get a 400 "Bad Request"

      $Token = 'zzzzzzzz'
      $NameSpaceId = "9999999999"
      
      $TargetFileDir = "/UCWorkspace/TestDeploy/"
      $InputZipPath = 'c:\temp\TestPushToDropBox.zip'
      $ZipFileName = "TestPushToDropBox.zip"
      
      $arg = '{ "path": "' + $TargetFileDir + $ZipFileName + '", "mode": "add", "autorename": true, "mute": false }'
      
      $authorization = "Bearer " + $Token
      
      $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
      
      $headers.Add("Authorization", $authorization)
      $headers.Add("Dropbox-API-Arg", $arg)
      $headers.Add("Content-Type", 'application/octet-stream')
      $nshead = '{".tag": "root", "root": $NameSpaceId}'
      $headers.Add("Dropbox-API-Path-Root", $nshead)
      
      $resp = try { 
      
      	Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $InputZipPath -Headers $headers 
      	
      } catch { 
      
      	$_.Exception.Response 
      
      }
      
      write-host $resp.StatusCode.value__ 
      write-host $resp.StatusCode 
      write-host $resp.StatusDescription
      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        What's in the response body for the 400? It should contain a more helpful error message.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,882 PostsLatest Activity: 8 hours ago
325 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!