Download to read offline



![using (var client = new HttpClient()) { var strings = await client.GetAsync("/api/values"); var strResult = await strings.Content.ReadAsStringAsync(); var serializer = new JavaScriptSerializer(); var result = serializer.Deserialize<string[]>(strResult); foreach (var s in result) { Console.WriteLine(s); } }](https://image.slidesharecdn.com/mvcsummit-asp-130728211833-phpapp02/75/ASP-NET-WEB-API-4-2048.jpg)





![using (var client = new HttpClient()) { client.DefaultRequestHeaders .Add("Authorization", "Basic d2FsZHlyOjEyMw=="); var strings = await client.GetAsync("/api/values"); var strResult = await strings.Content.ReadAsStringAsync(); var serializer = new JavaScriptSerializer(); var result = serializer.Deserialize<string[]>(strResult); foreach (var s in result) { Console.WriteLine(s); } } https://gist.github.com/waldyrfelix/3983405](https://image.slidesharecdn.com/mvcsummit-asp-130728211833-phpapp02/75/ASP-NET-WEB-API-10-2048.jpg)



The document discusses various formats for accessing REST web services including URI and HTTP methods. It provides code examples for making GET requests to a REST API from C# using HttpClient and jQuery AJAX calls. The examples also demonstrate how to add authentication headers to the requests. Links are included for an e-book on ASP.NET Web API and the author's Twitter profile.



![using (var client = new HttpClient()) { var strings = await client.GetAsync("/api/values"); var strResult = await strings.Content.ReadAsStringAsync(); var serializer = new JavaScriptSerializer(); var result = serializer.Deserialize<string[]>(strResult); foreach (var s in result) { Console.WriteLine(s); } }](https://image.slidesharecdn.com/mvcsummit-asp-130728211833-phpapp02/75/ASP-NET-WEB-API-4-2048.jpg)





![using (var client = new HttpClient()) { client.DefaultRequestHeaders .Add("Authorization", "Basic d2FsZHlyOjEyMw=="); var strings = await client.GetAsync("/api/values"); var strResult = await strings.Content.ReadAsStringAsync(); var serializer = new JavaScriptSerializer(); var result = serializer.Deserialize<string[]>(strResult); foreach (var s in result) { Console.WriteLine(s); } } https://gist.github.com/waldyrfelix/3983405](https://image.slidesharecdn.com/mvcsummit-asp-130728211833-phpapp02/75/ASP-NET-WEB-API-10-2048.jpg)

