Waldyr Felix MVP, MCPD, MCP e Arquiteto de Software http://waldyrfelix.net waldyrfelix@mwnow.com.br @WaldyrFelix
Recurso a ser acessado Formato 1 Formato 2 Formato 3 Formato 4 REST Web Service URI Métodos GET POST PUT DELETE
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); } }
$.ajax({ url: "/api/values", type: "GET", dataType: "json", success: function(data) { $(data).each(function(index, value){ console.log(index + ') '+ value); }); } });
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
$.ajax({ url: "/api/values", type: "GET", dataType: "json", beforeSend: function(xhr){ xhr.setRequestHeader( 'Authorization', 'Basic d2FsZHlyOjEyMw=='); }, success: function(data) { $(data).each(function(index, value){ console.log(index + ') '+ value); }); } }); https://gist.github.com/waldyrfelix/3983411
http://israelaece.com/post/e-Book-Introducao-ao-ASPNET-Web-API.aspx http://bit.ly/16MkazH Sigam-me no Twitter @WaldyrFelix

ASP.NET WEB API

  • 1.
    Waldyr Felix MVP, MCPD,MCP e Arquiteto de Software http://waldyrfelix.net waldyrfelix@mwnow.com.br @WaldyrFelix
  • 2.
    Recurso a seracessado Formato 1 Formato 2 Formato 3 Formato 4 REST Web Service URI Métodos GET POST PUT DELETE
  • 4.
    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); } }
  • 5.
    $.ajax({ url: "/api/values", type: "GET", dataType:"json", success: function(data) { $(data).each(function(index, value){ console.log(index + ') '+ value); }); } });
  • 10.
    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
  • 11.
    $.ajax({ url: "/api/values", type: "GET", dataType:"json", beforeSend: function(xhr){ xhr.setRequestHeader( 'Authorization', 'Basic d2FsZHlyOjEyMw=='); }, success: function(data) { $(data).each(function(index, value){ console.log(index + ') '+ value); }); } }); https://gist.github.com/waldyrfelix/3983411
  • 12.