MicroProfile Rest Client
Clone or download
andymc12 Merge pull request #131 from andymc12/90-uriInRegisterAnno
Issue 90: Allow URI to be set in `@RegisterRestClient` annotation
Latest commit 9c066bf Nov 9, 2018


Rest Client for MicroProfile

microprofile rest client


The MicroProfile Rest Client provides a type-safe approach to invoke RESTful services over HTTP. As much as possible the MP Rest Client attempts to use JAX-RS 2.0 APIs for consistency and easier re-use.


Here is an example - let’s say that you want to use a movie review service. The remote service might provide APIs to view users' reviews and allow you to post and modify your own reviews. You might start with an interface to represent the remote service like this:

 public interface MovieReviewService {
     Set<Movie> getAllMovies();

     Set<Review> getAllReviews( @PathParam("movieId") String movieId );

     Review getReview( @PathParam("movieId") String movieId, @PathParam("reviewId") String reviewId );

     String submitReview( @PathParam("movieId") String movieId, Review review );

     Review updateReview( @PathParam("movieId") String movieId, @PathParam("reviewId") String reviewId, Review review );

Now we can use this interface as a means to invoke the actual remote review service like this:

URI apiUri = new URI("http://localhost:9080/movieReviewService");
MovieReviewService reviewSvc = RestClientBuilder.newBuilder()
Review review = new Review(3 /* stars */, "This was a delightful comedy, but not terribly realistic.");
reviewSvc.submitReview( movieId, review );

This allows for a much more natural coding style, and the underlying MicroProfile implementation handles the communication between the client and service - it makes the HTTP connection, serializes the Review object to JSON/XML/etc. so that the remote service can process it.


This project only provides the specified API, a TCK and documentation. It does not provide an implementation. Various vendors are involved in this project and will provide their own implementation of this specification.

The following Implementations are available


This project is still under development - participation welcome!