You have a few ways to achieve that:
By default Retrofit handles nulls correctly for all null query parameters, so you can do something like:
@GET("/user/{id}/likes") void getLikes(@Path("id") int id, @Query("n") Integer number, @Query("pos") Integer pos Callback<String> cb);
If you use Object instead of int you can call to the method using null for the optional parameters:
getLikes(1, null, null, cb); // to get /user/1/likes
getLikes(1, 2, null, cb); // to get /user/1/likes?n=2
By using RequestInterceptor:
RestAdapter.Builder builder= new RestAdapter.Builder() .setRequestInterceptor(new RequestInterceptor() { @Override public void intercept(RequestFacade request) { request.addHeader("Accept", "application/json;versions=1"); if(/*condition*/){ request.addQueryParam(arg0, arg1) } } });