Hi,
I want to download with powershell a file from the dropbox.But I always get a 400 error.
$arg = '{"path": "/'+$SourceFilePath+'.txt"}'
$authorization = "Bearer <access token>"
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", $authorization)
$headers.Add("Dropbox-API-Arg", $arg)
Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/download -Method Post -Headers $headers -OutFile $SourceFilePath
My upload script works perfectly:
$arg = '{"path": "/'+$DestinationFilePath+'.txt","mode": "overwrite", "autorename": false, "mute": false }'
$authorization = "Bearer <access 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')
Invoke-RestMethod -Uri https://api-content.dropbox.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers
Can anyone tell me what's wrong with the download part?