HockeyApp API Post a Crash Report Issue c#

vasuvasu INMember

Hi Team,

I have been using below code to post crash/Exception report to HockeyApp but I always get Internal Server Error. Can anyone help me on this please.

using (HttpClient client = new HttpClient())
            {
                string log = "Exception thrown from here";
                client.DefaultRequestHeaders.Add("X-HockeyAppToken", "xxxxxxxxxxxxxxxxxxxxxxxxxx");

                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("*/*"));

                var content = new MultipartFormDataContent();
                var contentTypeString = content.Headers.ContentType.ToString().Replace("\"", "");
                content.Headers.Remove("Content-Type");
                content.Headers.TryAddWithoutValidation("Content-Type", contentTypeString);

                var stringContent = new StringContent(log);
                stringContent.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("text/plain");

                content.Add(stringContent, "log", "crash.log");

                var response = await client.PostAsync("https://rink.hockeyapp.net/api/2/apps/[APP_ID]/crashes/upload", content); 

}

Tagged:

Answers

Sign In or Register to comment.