devxlogo

How to Trigger a Synchronous GET Request

How to Trigger a Synchronous GET Request

For triggering a synchronous GET request we can rely on HTTP Client API as follows:

HttpClient client = HttpClient.newHttpClient();HttpRequest request = HttpRequest.newBuilder()                   .uri(URI.create("https://reqres.in/api/users/2"))                    .build();HttpResponse response = client.send(request, BodyHandlers.ofString());
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist