Boa noite, A chave fica exposta dessa forma? Ou deveria ter feito de outra forma?
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Scanner;
public class BuscadorDeLivros {
public static void main(String[] args) throws IOException, InterruptedException {
Scanner leitorDeLivros = new Scanner(System.in);
System.out.println("Digite o nome do Livro : ");
var nomeDoLivro = leitorDeLivros.nextLine();
String endereco = "https://www.googleapis.com/books/v1/volumes?q=" + URLEncoder.encode(nomeDoLivro, "UTF-8") + "&apikey=0000000";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(endereco))
.build();
HttpResponse<String> response = client
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}