R Syed
R Syed

Reputation: 1093

REST Get Call in Java for Pagination

I'm using a REST Client to do a GET All Users using Java. I have this working, I have a method different for Retrieving All Users and Retrieving User by ID. In the All Users Method I want to add a pagination logic, where instead of this url /api/v1/Users I should be able to give /api/v1/Users?count=10 . Is there any way I can read the value 10 from the url for the All Users method? Currentl My method looks like this.

@GET
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response retrieveAll() {
......

...

return response
}

Upvotes: 0

Views: 2755

Answers (1)

public Response retrieveAll(@QueryParam("count") Integer count) {
  ...
}

Upvotes: 2

Related Questions