Bookmark and Share

What is CRest

CRest (Client Representational State Transfer or Client REST) is a lightweight JAX-RS compatible framework aiming to simplify the integration of external REST services into java applications.

CRest allows the developer to focus on the essential aspects of the integration of a REST service, such as the definition of:

  • the java interface that reflects the remote REST API.
  • the data model the interface will deal with.

The rest is achieved by annotating the java interface with the relevant information such as the service end-point, the desired timeouts, parameters etc...

Here is a quick example of what a CRest annotated interface would look like:

public interface StatusService {

    Status updateStatus(
            @FormParam("status") String status,
            @QueryParam("lat") float lat,
            @QueryParam("long") float longitude);

    User[] getRetweetedBy(
            @PathParam("id") long id,
            @QueryParam("count") long count,
            @QueryParam("page") long page);

    User[] getFollowers(@QueryParam("user_id") long userId);


And here how you would get an instance of it:

// Get a CRest instance
CRest crest = CRest.getInstance();

// Get a StatusService instance
StatusService statusService =;