cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn about how Kev uses Dropbox to make sure he keeps track of all the new music he listens to? Check out his tips 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: 

Error in call to API function "files/download"

Error in call to API function "files/download"

nguyenthanhliem
New member | Level 2

I use DropBox API to implement Dropbox in Xamarin.Forms (NET Standard). I upload a file success, but when I download I get this error

Dropbox.Api.BadInputException: Error in call to API function "files/download": Bad HTTP "Content-Type" header: "application/x-www-form-urlencoded". Expecting one of "text/plain", "text/plain; charset=utf-8", "application/octet-stream", "application/octet-stream; charset=utf-8".

using (var client = new DropboxClient(this.AccessToken)) { using (var response = await client.Files.DownloadAsync(file.FilePath + "/" + file)) { var pickedFile = await response.GetContentAsByteArrayAsync(); //FileImagePreview.Source = ImageSource.FromStream(() => pickedFile); } }

1 Accepted Solution

Accepted Solutions

Re: Error in call to API function "files/download"

mostafa90
New member | Level 2

this answer solved my problem.

https://github.com/dropbox/dropbox-sdk-dotnet/issues/77#issuecomment-487972169 

 

Thanks!
In addition, I think the problem originates from Xamarin using the "AndroidClientHandler" as HttpMessageHandler. So using the current lib version, a workaround would be explicitly setting the (less efficient) HttpClientHandler
dbx = new DropboxClient(accessToken, new DropboxClientConfig() { HttpClient = new HttpClient(new HttpClientHandler()) });

 

View solution in original post

6 Replies 6

Re: Error in call to API function "files/download"

DiwakarK
Explorer | Level 4

I am facing error when downloading shared file using DropBox API. getting 503.

Re: Error in call to API function "files/download"

Greg-DB
Dropboxer

@nguyenthanhliem The Dropbox .NET SDK isn't officially supported on Xamarin, but there was another thread where a developer ran into this issue and was reportedly able to resolve it here:

https://www.dropboxforum.com/t5/API-Support-Feedback/Content-Type-setting-for-downloading-using-drop... 

Re: Error in call to API function "files/download"

Greg-DB
Dropboxer

@DiwakarK It sounds like you're experiencing a different issue than the one reported in this thread. Please open a new thread with the details of the issue, such as the code to reproduce it and the full error/output, so we can look into it:

https://www.dropboxforum.com/t5/forums/postpage/board-id/101000014 

Re: Error in call to API function "files/download"

nguyenthanhliem
New member | Level 2

I have look in your link and I think they still not found solution for this!

Re: Error in call to API function "files/download"

Greg-DB
Dropboxer

@nguyenthanhliem I was referring to this comment in particular:


@Anoop_Brijmohun wrote:

Found the solution here

https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/http-stack?tabs=windows


 I'm afraid I can't offer more information though, as the Dropbox .NET SDK isn't officially supported on Xamarin. Apologies I can't be of more help in that regard!

Re: Error in call to API function "files/download"

mostafa90
New member | Level 2

this answer solved my problem.

https://github.com/dropbox/dropbox-sdk-dotnet/issues/77#issuecomment-487972169 

 

Thanks!
In addition, I think the problem originates from Xamarin using the "AndroidClientHandler" as HttpMessageHandler. So using the current lib version, a workaround would be explicitly setting the (less efficient) HttpClientHandler
dbx = new DropboxClient(accessToken, new DropboxClientConfig() { HttpClient = new HttpClient(new HttpClientHandler()) });

 

Who's talking

Top contributors to this post

  • User avatar
    mostafa90 New member | Level 2
  • User avatar
    Greg-DB Dropboxer
  • User avatar
    nguyenthanhliem New member | Level 2
What do Dropbox user levels mean?
Need more support?