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

It’s surprisingly complex to do the simplest HTTP calls with the standard Java library. Resty hopes to change that.

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, use authenticate method to add credentials, then call one of the content type specific methods. The idea is that the method name will convey the expected content type.

import static us.monoid.web.Resty.*;
import us.monoid.web.Resty.*;

GETting an URL (as JSON):

new Resty().json(url);

POSTing to an URL (using multipart/form-data) and expecting JSON back:

  new Resty().json(url, form(data("name", "Draper"),
              data("occupation", "Ad Man")));

PUTting content and expecting JSON back:

  new Resty().json(url, put(content(someJSON)));

DELETE a resource via URL expecting JSON back:

  new Resty().json(url, delete());


A simple HTTP REST client for Java


  1. Simple REST client

  2. Fluid-style API

  3. Very easy to use

  4. Built-in support for JSON, XML, Text, Binary


  6. Cookies, HTTP AUTH

  7. Apache License 2.0


  1.   JAR File

  2.   Maven?




There is built-in support for accessing JSON objects, parsing XML and executing XPath expressions, downloading content directly to disc in addition to simple cookie and authentication management.

Here is a more complex example:

Resty r = new Resty();

Object name = r.json("")


A lot is happening here behind the scenes. Calling r.json(..) with a URL instructs Resty to do a GET operation and treat the returned resource as JSON. The method returns a JsonResource, which offers - among others - a get(...)  which parses a path expression (similar to JsonPath) to access the placeName of the first postal code.

Please note that all resources returned are also Resty instances, so you can use those to retrieve other resources.

Now go ahead and study some more examples, download the thing and provide feedback.