I'm using Square's Retrofit library. I need to implement request with variable number of parameters. I've found suggestion (link) and I try this:
I change
@GET("someURL")
void method(
@Query("firstParameter") int firstValue,
@Query("secondParameter") String secondValue,
Callback<Response> cb
);
to
@POST("someURL")
void method(
@Body Map<String, Object> parameters,
Callback<Response> cb
);
and use follow:
final HashMap<String, Object> param = new HashMap<String, Object>();
param.put("firstParameter", firstValue);
param.put("secondParameter", secondValue);
The first way works great, but the second one doesn't work. What's wrong?