I can't figure out how to delete a file in my Dropbox using Powershell. I can upload fine using this :
$arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }'
$authorization = "Bearer " + $DropBoxAccessToken
$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://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headersBut I don't now how to use "https://api.dropboxapi.com/2/files/delete_v2" even after reading the documentation (I'm not a developer so this is new to me).
I used the Dropbox API Explorer • delete_v2 to generate the code for a curl request which works from the Dropbox API Explorer but I'd like to use PowerShell in the same way I do for uploading. The working curl request is:
curl -X POST https://api.dropboxapi.com/2/files/delete_v2 \
--header 'Authorization: Bearer <access-token>' \
--header 'Content-Type: application/json' \
--data '{"path":"/20181009"}'
Can anyone tell me how to use "Invoke-RestMethod -Uri https://api.dropboxapi.com/2/files/delete_v2" in PowerShell similar to the upload method above to delete a folder? Thanks.