cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Tell us what you want to see on the Community here!
Close

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"

Highlighted

Error in call to API function "files/download"

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
Highlighted

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

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
Highlighted

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

Explorer | Level 4

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

Highlighted

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

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

Highlighted

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

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 

Highlighted

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

New member | Level 2

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

Highlighted

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

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!

Highlighted

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

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

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?