cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

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

dc_ucw
New member | Level 2
Go to solution

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




1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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.

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

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
New member | Level 2
Go to solution

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
Dropbox Staff
Go to solution

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

dc_ucw
New member | Level 2
Go to solution

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!

Need more support?