我需要關於如何在改進請求中使用多個參數'@path'的幫助。我嘗試使用單參數'@Path'這種方式工作。在改進URL中製作更多@path
@GET("topics/{id}?userId=58bf87d343c3ccb5793b2e99")
Call<ResponseBody> artikel(@Path("id") String id);
,但我想用兩個參數是這樣
ApiService.class:
@GET("topics/{id}?userId={userId}")
Call<ResponseBody> artikelFeeds(@Path("id") String id, @Path("userId") String userId);
會拋出錯誤「路徑不能有替換塊」 ,這是改造的一部分客戶端
Call<ResponseBody> get_artikel;
Retrofit retrofit;
retrofit = new Retrofit.Builder()
.baseUrl(Status.HOST_ARTICLE)
.addConverterFactory(GsonConverterFactory.create())
.client(httpClient)
.build();
ApiService apiService = retrofit.create(ApiService.class);
get_artikel = apiService.artikelFeeds(id,userId);
如何註釋呢? 'ApiService apiService = retrofit.create(ApiService.class); get_artikel = apiService.artikelFeeds(id,userId);' –
使用相同。沒有變化 –
我得到錯誤代碼500,爲什麼? –