In this post under JAX-RS Client, I will show with example how to extend base URL with path segments. Suppose you want to access below two REST apis. These two apis return user information with id 2 and 3. https://jsonplaceholder.typicode.com/users/2https://jsonplaceholder.typicode.com/users/3 To access these two urls you will create two “WebTarget” instances as shown below WebTarget…… Continue reading Extending base URL with path segments
Month: February 2023
JAX-RS Client API simple DELETE example
In this post under JAX-RS Client, I will show with example how to perform a DELETE REST call. Below is the complete code for your reference Main Class 1 package defaultPackage; 2 3 import jakarta.ws.rs.client.Client; 4 import jakarta.ws.rs.client.ClientBuilder; 5 import jakarta.ws.rs.client.Invocation; 6 import jakarta.ws.rs.client.WebTarget; 7 import jakarta.ws.rs.core.Response; 8 9 public class Example4 { 10 public…… Continue reading JAX-RS Client API simple DELETE example
JAX-RS Client API simple PUT example
In this post under JAXRS Client, I will show with simple example how to use the JAXRS Client API to make a PUT request to REST api resource. Below is the complete code for the example Main class 1 package defaultPackage; 2 3 import jakarta.ws.rs.client.Client; 4 import jakarta.ws.rs.client.ClientBuilder; 5 import jakarta.ws.rs.client.Entity; 6 import jakarta.ws.rs.client.Invocation; 7…… Continue reading JAX-RS Client API simple PUT example