HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://trains.p.rapidapi.com/")) .header("content-type", "application/json") .header("X-RapidAPI-Host", "trains.p.rapidapi.com") .header("X-RapidAPI-Key", "874536d232mshda09d11df129587p14ef94jsn4d668b0faaea") .method("POST", HttpRequest.BodyPublishers.ofString("{\n \"search\": \"Rajdhani\"\n}")) .build(); HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body());

Comments

Popular posts from this blog

Lucknow Chikan Art : Chikan khaya aur Pehna jata hai Lucknow me.