2014-07-08 66 views
0

我正在嘗試使用Retrofit從OpenStreetMap的立交橋API獲取數據。Android翻新的URL查詢語法

URL字符串的GET請求如下所示:

http://www.overpass-api.de/api/xapi?way[highway=track][bbox=-122.53,37.86,-122.52,37.87] 

據我所知道的,RestAdapter會是這個樣子:

RestAdapter restAdapter = new RestAdapter.Builder() 
    .setEndpoint("http://www.overpass-api.de") 
    .build(); 

,並在接口GET方法看起來像這樣:

@GET("/api/xapi") 
Response listWays(WHAT GOES HERE??); 

沒有交流的「方式」的存在公司=someValue[highway=track][bbox=...]在括號中都顯得有點不同尋常。

我該如何爲這個GET請求編寫這個接口方法?

+0

Retofit不能覆蓋這個用例(沒有醜陋的粗俗攻擊)。抱歉!你能提出一個問題:https://github.com/square/retrofit/issues/new –

+0

@JakeWharton https://github.com/square/retrofit/issues/556 –

+0

@JakeWharton我們不能使用類似的東西 '@GET(「/ api/xapi?way [highway = {track}] [bbox = {x1},{x2},{y1},{y2}]」)響應listWays(String track,double x1,雙x2,雙y1,雙y2);' ? – colriot

回答

0

我認爲在這種情況下你應該使用改進的@Query參數。