Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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()) });
I am facing error when downloading shared file using DropBox API. getting 503.
@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:
@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
I have look in your link and I think they still not found solution for this!
@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!
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()) });
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on Twitter or Facebook.
For more info on available support options, see this article.
If you found the answer to your question, please 'like' the post to say thanks to the user!