This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class REST { | |
public static void calloutAPI(){ | |
try{ | |
Http http = new Http(); | |
HttpRequest req = new HttpRequest(); | |
req.setEndpoint('https://reqres.in/api/users?page=1'); | |
req.setMethod('GET'); | |
HttpResponse res = http.send(req); | |
if(res.getStatusCode() == 200){ | |
//Aqui vamos trabalhar do JSON |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class REST { | |
public static void calloutAPI(){ | |
try{ | |
Http http = new Http(); | |
HttpRequest req = new HttpRequest(); | |
req.setEndpoint('https://reqres.in/api/users?page=1'); | |
req.setMethod('GET'); | |
HttpResponse res = http.send(req); | |
if(res.getStatusCode() == 200){ | |
//Aqui vamos trabalhar do JSON |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class REST { | |
private static List<Contact> listaContatos = new List<Contact>(); //Lista vazia, vamos inserir os contatos nela dentro do loop "for" | |
public static void calloutAPI(){ | |
try{ | |
RestModel wrapper = new RestModel(); | |
Http http = new Http(); | |
HttpRequest req = new HttpRequest(); | |
req.setEndpoint('https://reqres.in/api/users?page=1'); | |
req.setMethod('GET'); | |
HttpResponse res = http.send(req); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"page": 1, | |
"per_page": 3, | |
"total": 12, | |
"total_pages": 4, | |
"data": [ | |
{ | |
"id": 1, | |
"email": "[email protected]", | |
"first_name": "George", |