You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

kashiwagi_yhi's avatar
kashiwagi_yhi
Explorer | Level 3
5 months ago

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

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.

  • iNeil's avatar
    iNeil
    Icon for Dropbox Engineer rankDropbox 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's avatar
      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's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox 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?

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,885 PostsLatest Activity: 3 hours ago
326 Following

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 or Facebook.

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!