Retrofit: multiple query parameters in @GET command?

后端 未结 4 1105
误落风尘
误落风尘 2020-12-23 09:30

I am using Retrofit and Robospice to make API calls in my android application. All @POST methods work great, and so do @GET commands without any parameters in the URL, but I

4条回答
  •  半阙折子戏
    2020-12-23 09:56

    You can create a Map of params and send it like below:

    Map paramsMap = new HashMap();
    paramsMap.put("p1", param1);
    paramsMap.put("p2", param2);
    
    // Inside call
    @GET("/my/api/call")
    Response getMyThing(@QueryMap Map paramsMap);
    

提交回复
热议问题