Calling a Web API from Java using Unirest

Working with web services has become standard practice today, and it always felt strange to me how much work it took me to call one. I was doing it wrong :-). I found the Unirest library, and my life has been happy ever since.

To show how simple it is, I wrote a short program that queries the StackExchange API for questions in the StackOverflow site:

This call invokes a GET request to that accepts JSON, including transforming the response to a JSON object that can be easily used later.

Pretty cool, uh? The world is finally going forward.

You can find this example in my examples repository. Enjoy

2 comments on “Calling a Web API from Java using Unirest

  1. Hi, Can I use XML instead of Json? What are the changes required if I use xml?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.