---------- FAZER REQUISIÇÃO API EM JAVA ----------
public class Main {
public static void main(String[] args) {
ConsumoApi api = new ConsumoApi();
String url = "[Link]
String dados = [Link](url);
[Link](dados);
}
}
public class ConsumoApi {
public String obterDados(String endereco) {
HttpClient client = [Link]();
HttpRequest request = [Link]()
.uri([Link](endereco))
.build();
HttpResponse<String> response = null;
try {
response = client
.send(request, [Link]());
} catch (IOException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
String json = [Link]();
return json;
}
}