Over a million developers have joined DZone.

Resty for Java - a simple, light-weight HTTP/REST client API

DZone's Guide to

Resty for Java - a simple, light-weight HTTP/REST client API

· ·
Free Resource

Tired of using tons of code around URLConnection?  Apache HTTP client too complex? Jersey client too fickle?

Maybe Resty is to your liking then.

Resty is a small, convenient API to talk to RESTful services from Java.

Its focus is on simplicity and ease-of-use, often requiring only two lines of code to access RESTful web services.

Basic usage is very simple:
Create a Resty instance, then call one of the content type specific methods to GET  the contents of an UR (or POST to it and stuff).

Here is an example on how to use the geonames web service. It retrieves the JSON object and gets the name of a place from the zip code using an JasonPath or XPath-like expression:

Resty r = new Resty();
String name = r.json("http://ws.geonames.org/postalCodeLookupJSON?postalcode=66780&country=DE").

 More on http://beders.github.com/Resty/

 Hosted over at github. Come over and help out. It's fun!


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}