How can I write a programm to delete a folder in my dropbox. There are all permissions set. The accesstoken is ok. I'm able to create a folders in my code.
Unfortunately deleting a folder results in a 'bad request'. My folder structure is
Main/
....2023/
....2024/
Here is the code segment:
using (HttpClient httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
HttpResponseMessage response = await httpClient.PostAsync("https://api.dropboxapi.com/2/files/get_metadata",
new StringContent($"{{\"path\": \"{filePath}\"}}"));
if (response.IsSuccessStatusCode)
The variable response contains:
StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Content-Security-Policy: sandbox allow-forms allow-scripts
X-Content-Type-Options: nosniff
Accept-Encoding: identity,gzip
Vary: Accept-Encoding
X-Dropbox-Response-Origin: far_remote
X-Dropbox-Request-Id: 75a037a2e8b24097b5188d266d6b9b71
Cache-Control: no-cache
Date: Wed, 20 Sep 2023 10:11:08 GMT
Server: envoy
Content-Length: 226
Content-Type: text/plain; charset=utf-8
}}
I hope you can help me.
best regards
Peter