{ try { String data = makeHttpRequest("https://jsonplaceholder.typicode.com/todos/"); System.out.println(data); } catch(URISyntaxException | IOException | InterruptedException e) { e.printStackTrace(); } } public static String makeHttpRequest(String url) throws URISyntaxException, IOException, InterruptedException { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(new URI(url)) .build(); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); return response.body(); } } Uses HttpClient to make http request