cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Musicians, convert your MuseScore files to PDF to play music on the go! Learn more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to Download Files Using .NET SDK Since 7/11

Unable to Download Files Using .NET SDK Since 7/11

kashiwagi_yhi
Explorer | Level 3

Hello,

 

I am developing an application using the Dropbox API and .NET SDK. I have been successfully downloading files using the SDK until 7/11, but since then, the download functionality has stopped working. I am seeking assistance to understand why this is happening.

 

The exception I am encountering is a BadInputException. I initially thought there might be an issue with the arguments, but the arguments have not changed since the downloads were working. The download API only requires a file path as an argument, so I believe it is unlikely to be an argument error. Additionally, the files do exist on Dropbox.

 

When I test the download functionality using the Dropbox API Explorer, it works fine. This leads me to believe there may be an issue with the SDK. However, it is puzzling that the SDK suddenly stopped working despite being functional before.

https://dropbox.github.io/dropbox-api-v2-explorer/#files_download

 

Here are the details of my environment and the versions I have tested:

Error details:

 

Dropbox.Api.BadInputException
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Dropbox - 400</title>
<link href="https://cfl.dropboxstatic.com/static/metaserver/static/css/error.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="https://cfl.dropboxstatic.com/static/images/favicon.ico"/>
</head>
<body>
<div class="figure">
<img src="https://assets.dropbox.com/www/en-us/illustrations/spot/target-miss.svg" alt="Error: 400"/>
</div>
<div id="errorbox">
<h1>Error (400)</h1>Something went wrong. Don't worry, your files are still safe and the Dropbox team has been notified. Check out our Status Page to see if there is a known incident, our Help Center and forums for help, or head back to home.
</div>
</body>
</html>

 

 

I would appreciate any help or insights into resolving this issue.

 

Thank you.

5 Replies 5

iNeil
Dropbox Engineer

Hello @kashiwagi_yhi,

I'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information. Please reply with:

- the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
- the parameter values that you are using with the Dropbox .NET SDK when calling the endpoint(s)

kashiwagi_yhi
Explorer | Level 3

Here is the simple code for downloading a file. I have saved "Test.txt" on Dropbox beforehand to test this.

 

 

using System;
using System.Net.Http;
using Dropbox.Api;
using Dropbox.Api.Files;
using Dropbox.Api.Stone;

HttpClient httpClient = new HttpClient()
{
    Timeout = TimeSpan.FromMinutes(20)
};
DropboxClientConfig clientConfig = new DropboxClientConfig("application_product_name")
{
    HttpClient = httpClient
};
DropboxClient dropboxClient = new DropboxClient("refresh_token", DropboxConfig.AppKey, clientConfig);

try
{
    using (IDownloadResponse<FileMetadata> response = await dropboxClient.Files.DownloadAsync("/Test.txt"))
    {
        byte[] result = await response.GetContentAsByteArrayAsync();
        Debug.LogFormat("DownloadAsync Success {0}", result.Length);
    }
}
catch (Exception ex)
{
    Debug.LogWarningFormat("DownloadAsync Error {0}", ex.ToString());
}

 

 

The content of ex.ToString() is as follows:

 

DownloadAsync Error Dropbox.Api.BadInputException: <!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Dropbox - 400</title>
<link href="https://cfl.dropboxstatic.com/static/metaserver/static/css/error.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="https://cfl.dropboxstatic.com/static/images/favicon.ico"/>
</head>
<body>
<div class="figure">
<img src="https://assets.dropbox.com/www/en-us/illustrations/spot/target-miss.svg" alt="Error: 400"/>
</div>
<div id="errorbox">
<h1>Error (400)</h1>Something went wrong. Don't worry, your files are still safe and the Dropbox team has been notified. Check out our Status Page to see if there is a known incident, our Help Center and forums for help, or head back to home.
</div>
</body>
</html>

  at Dropbox.Api.DropboxRequestHandler.RequestJsonString (System.String host, System.String routeName, System.String auth, Dropbox.Api.DropboxRequestHandler+RouteStyle routeStyle, System.String requestArg, System.IO.Stream body) [0x004db] in <3bfaee380a004dbbb66f97b905c0a981>:0 
  at Dropbox.Api.DropboxRequestHandler.RequestJsonStringWithRetry (System.String host, System.String routeName, System.String auth, Dropbox.Api.DropboxRequestHandler+RouteStyle routeStyle, System.String requestArg, System.IO.Stream body) [0x00179] in <3bfaee380a004dbbb66f97b905c0a981>:0 
  at Dropbox.Api.DropboxRequestHandler.Dropbox.Api.Stone.ITransport.SendDownloadRequestAsync[TRequest,TResponse,TError] (TRequest request, System.String host, System.String route, System.String auth, Dropbox.Api.Stone.IEncoder`1[T] requestEncoder, Dropbox.Api.Stone.IDecoder`1[T] responseDecoder, Dropbox.Api.Stone.IDecoder`1[T] errorDecoder) [0x000a5] in <3bfaee380a004dbbb66f97b905c0a981>:0 

(Truncated for brevity)

 

 

Please review and let me know if there are any additional adjustments needed.

Greg-DB
Dropbox Staff

Thanks for sharing this. I tried out this code though, and it worked successfully for me. Can you confirm if this was the exact code that produced the error you saw? For instance, did you change any of the parameter values after you reproduced the issue before you posted this? If so, please share the actual parameter values you used to reproduce the issue, except for the refresh token.

 

Also, have you made any changes to the Dropbox SDK's code?

kashiwagi_yhi
Explorer | Level 3

Thank you for testing, @Greg-DB .

 

I also tried it again on my side. Strangely, it now works successfully.

Even the code that was not working since 7/11 is now able to download files successfully.

I have not changed the code or parameters.

 

Could there have been a change on the server side?

 

Well, I'm glad it's working now, but I still find it quite puzzling why this happened in the first place.

 

Thank you.

Greg-DB
Dropbox Staff

A server update caused unencoded header values to be rejected. We’ve updated the server to accept these requests again so this should be working now.

 

However, the .NET SDK should have automatically handled this for you anyway, so we would still want to check on that. If possible, please share the answers to the questions in my previous message so we can look into that and check if there are any related bugs in the .NET SDK.

 

For reference, by "parameter values", I mean both the user agent you put as "application_product_name" and the path you put as "/Test.txt".

 

Thanks!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    kashiwagi_yhi Explorer | Level 3
  • User avatar
    iNeil Dropbox Engineer
What do Dropbox user levels mean?