2015-11-23 29 views
1

我想用改裝製作Get請求使用改造

路徑,使reuqest是http://geocode-maps.yandex.ru/1.x/?format=json&geocode=latitude%2Clongitude

我現在已經這樣做請求Yandex的:

@GET("/?format=json&geocode={geocode}") 
Call<YandexResponse> getGeoCollection(@Path("geocode") String geocode); 

,當我把它叫做我是得到以下例外:

URL查詢字符串「format = json & geocode = {geocode}」不能有替換塊。對於動態查詢參數使用@Query。

如何正確提出請求?

+0

的可能的複製[改裝錯誤URL查詢字符串必須沒有替換塊(http://stackoverflow.com/questions/24610243 /改裝的錯誤網址查詢字符串,必不具備的替換塊) – ehehhh

回答

1
@GET("/") 
Call<YandexResponse> getGeoCollection(@Query("geocode") String geocode, @Query("format") String format); 

那麼你應該手動將格式函數調用:

webService.getGeoCollection("address", "json");