带参数
@GET("user/info")
Call getUserInfo(@Query("id") int user_id);
@GET("user/{id}")
Call getUserInfoWithPath(@Path("id") int user_id);
api= retrofit.create(Api.class);
Call userInfo =api.getUserInfo(3);
带多个参数
@GET("user/info")
Call getUserInfoWithMap(@QueryMapMap map);
HashMap map =new HashMap<>();
map.put("id","1");
map.put("id","2");
map.put("id","3");
api.getUserInfoWithMap(map).enqueue(new Callback() {
@Override
public voidonResponse(Call call, Response response) {
}
@Override
public voidonFailure(Call call, Throwable t) {
}
});