Hello,
First off, I did search the forums. This post , titled the same as this help request, seemed similar but was not helpful.
I have the following simple curl upload working fine:
curl -X POST https://content.dropboxapi.com/2/files/upload \
--header "Authorization: Bearer MyKeyGoesHereButThisIsNotReallyIt" \
--header "Dropbox-API-Arg: {\"path\": \"/test.txt\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}" \
--header "Content-Type: application/octet-stream" \
--data-binary @test.txt
And this is that same request converted to powershell - as you can see, I'm using the same API args.
$arg = '{ "path": "test.txt", "mode": "add" "autorename": true, "mute": false, "strict_conflict:" false }'
$authorization = "Bearer MyKeyGoesHereButThisIsNotReallyIt"
$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')
$response = Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile test.txt -Headers $headers
However, I'm getting back Error 400, Bad Request.
Why is this throwing a bad request error? I'm trying with the same args in both, same file to upload, but with Powershell, I just get this error. I'm not making any changes to the app between the two.