Java GET request using Unirest

In this post we will provide examples of how to make a GET request using Unirest. Unirest is an increasingly popular HTTP client library, with a great API making your code very readable.


You will need to add the following dependency to your maven project

GET request using Unirest:

The examples below include get request with header, get request with query string and get request with basic auth.

Simple GET request with headers:

NOTE: The request is executed when the asJson() method is called.

GET request with query string:

The above example will execute the following request:

GET request with Basic authentication:

In conclusion, I hope this post has helped you understand the basics of using the Unirest HTTP client.

Similar posts:

  1. Calling rest API with curl
  2. Convert JSON to a java object
  3. HttpCLient POST request example


  1. Unirest API documentation


Leave a Reply