REST Clients

Spring Boot RestClient (with Examples)

Starting Spring Framework 6.1 and Sring Boot 3.2, we can use the Spring RestClient for performing HTTP requests using a fluent and synchronous API. The RestClient works over the underlying HTTP client libraries such the JDK HttpClient, Apache HttpComponents, and others. As the name suggests, RestClient offers the fluent API design of WebClient and the functionality of RestTemplate. The …

Retrofit 2 Tutorial: Declarative REST Client for Android

In this Retrofit 2 tutorial, we will learn the basics of Retrofit and then we will create a declarative REST client for Android for executing HTTP requests against a REST API. 1. What is Retrofit? Retrofit was developed by Square and in its documentation, it is a type-safe REST client …

Basic Auth with Spring RestTemplate

Learn to add basic authentication to http requests invoked by Spring RestTemplate while accessing rest apis over the network. 1. Maven dependencies To work with Spring RestTemplate and HttpClient API, we must include spring-boot-starter-web and httpclient dependencies in pom.xml file. In this RestTemplate basic authentication tutorial, we are using dependencies. …

Generate REST Client with Swagger Codegen

Swagger can be integrated with REST APIs in below ways – A top-down approach – First API specification and then code generation. A botton-up approach – First API code and then Swagger integration. In this tutorial, we will learn the top down approach.

Getting Started with Jersey Client

Jersey 2 client API finds inspiration in the proprietary Jersey 1.x Client API. In this Jersey client example, we will learn to build client API and invode different REST methods and consule the API results.

Consuming REST APIs with RESTEasy Client

So far in this blog, we have been learning about building RESTful webservices which are server side components. In this post, we will learn to build a RESTful client for consuming the webservices written in previous posts. I will be re-using the code base written for RESTEasy + JAXB xml …

Apache HttpClient Examples for Consuming REST APIs

Apache HttpClient simplifies the interactions with RESTful APIs by supporting various HTTP methods, headers, and request configurations. This article will explore how to consume REST APIs using Apache HttpClient5 with examples. 1. Setup Before diving into implementation, we need to import the latest version of Apache HttpClient. Next, we will …

Writing a Native Java REST Client

So far in this blog, we have been learning about building RESTful webservices which are server side components. In this post, we will learn to build a RESTful client for consuming the webservices written in previous posts. I will be re-using the code base written for RESTEasy + JAXB xml …

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.