Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
D-B
8 years agoExplorer | Level 3
Delete Folder Using PowerShell
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": fals...
Greg-DB
Dropbox Community Moderator
8 years agoI believe your second version is closer, as it actually reads the body. (The first one doesn't appear to.)
In both though, you're not actually printing out the result or saving it anyway. E.g., something like:
Write-Output $responseBody
D-B
8 years agoExplorer | Level 3
I get output now, thanks.
Your request's HTTP request method is "DELETE", which is not supported by the Dropbox API v2.
- Greg-DB8 years ago
Dropbox Community Moderator
That output indicates that the issue is that you're using the "DELETE" method, which isn't allowed. The API expect the "POST" method.
That's presumably due to the "-Method Delete" in your code; for POST you would likely need to set "-Method Post".
- D-B8 years agoExplorer | Level 3
This is the response when I changed Delete to Post.
Error in call to API function "files/delete:2": Unexpected HTTP headers: "Dropbox-Api-Arg"
When removing the line $headers.Add("Dropbox-API-Arg", $arg) the response is:
Error in call to API function "files/delete:2": request body: could not decode input as JSON
- Greg-DB8 years ago
Dropbox Community Moderator
That is also expected, as this endpoint requires the parameters be sent as JSON in the request body. Please refer to my earlier comment for links to documentation for this.
About 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!