Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

dc_ucw's avatar
dc_ucw
New member | Level 2
8 years ago
Solved

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.

4 Replies

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago

    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
    8 years ago

    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 Community Moderator rankDropbox Community Moderator
    8 years ago

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

  • dc_ucw's avatar
    dc_ucw
    New member | Level 2
    8 years ago

    Yes, that would help wouldn't it?  Anyways it was a JSON error.  I fixed it - the upload works well now.  Thanks for the help - much appreciated!

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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, Facebook or Instagram.

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!