Sunday, 22 May 2022
Home »
»
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());
0 comments:
Post a Comment