Geeks With Blogs
FOXJAZZ developing with .net
 using (var client = new HttpClient())
            {
                string contentType = "application/json";
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(contentType));
                var response = client.GetAsync(baseuri).Result;

                if (response.IsSuccessStatusCode)
                {
                    var responseContent = response.Content;

                    // by calling .Result you are synchronously reading the result
                    string responseString = responseContent.ReadAsStringAsync().Result;
                    eveHome = JsonConvert.DeserializeObject<EveHome>(responseString);
                    
                }
            }
Posted on Monday, October 21, 2019 3:14 AM | Back to top


Comments on this post: http client gets data from service call

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © foxjazz | Powered by: GeeksWithBlogs.net