2017-05-20 25 views
0
https://my/api/call/v1/json/search_thing?parameters={"api_key":"API_KEY","query":{"perpage":50}} 

爲此,我提出使改造網址與下列參數

Retrofit retrofit = new Retrofit.Builder() 
       .baseUrl("my/api/call/v1/") 
       .addConverterFactory(GsonConverterFactory.create()) 
       .build(); 

但是對於界面,我該如何填寫???

@GET("???") 
    Call<JSONResponse> getJSON(); 

我試圖

??? = "json/search_thing?parameters={"api_key":"sdfsdf","query":{"perpage":50}}" 

,但沒有奏效。

基本上應該怎麼嵌入

json/search_thing?parameters={"api_key":"API_KEY","query":{"perpage":50}} 

到我的界面

回答

0

它的工作實際上是有問題的格式在放置到GET()。

@GET("json/search_thing?parameters={"api_key":"sdfsdf","query":{"perpage":50}}") 

默認情況下,當我們粘貼它時,android studio會添加用於製作url的轉義字符。