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
nguyenthanhliem
6 years agoNew member | Level 2
Error in call to API function "files/download"
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); } }
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()) });
- DiwakarKExplorer | Level 4
I am facing error when downloading shared file using DropBox API. getting 503.
- Greg-DBDropbox Staff
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
- Greg-DBDropbox Staff
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:
- nguyenthanhliemNew member | Level 2
I have look in your link and I think they still not found solution for this!
- Greg-DBDropbox Staff
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!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf 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!