API Implementation
RapidAPI API
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Random;
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://wft-geo-db.p.rapidapi.com/v1/geo/adminDivisions"))
.header("X-RapidAPI-Key", "9d1b75d842msh20486d8bf8d5c19p1904abjsneb2943a9124c")
.header("X-RapidAPI-Host", "wft-geo-db.p.rapidapi.com")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());