3

I'm trying to request the current weather to Yahoo using Retrofit. I'm facing an issue when trying to pass the city. I understand that I have to use @Query

Yahoo queries are a bit complex and I'm not sure how to proceed. Here is my code

@GET("yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20**text%3D%22brussels%2C%20be%22)%20and%20u%3D%27c%27&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys")

In this complex query, I need to update city parameter from text%3D%22brussels%2C%20be to text%3D%paris%2C%20fr for instance.

Any help would be highly appreciated;

Thanks in advance,

Isabelle
  • 1,457
  • 5
  • 19
  • 44

1 Answers1

3
@GET("yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20**text%3D%22{location}%2C%20be%22)%20and%20u%3D%27c%27&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys")
Call<response> groupList(@Path("location") String location);

If i understand your question correctly, this should work.

Timvr01
  • 476
  • 4
  • 15
  • Thank you Tim. So I in my Activity, I need to pass the city variable, but this is where I'm stuck. If I pass it that way: WeatherAPI.Factory.getmWeatherAPI().getWeather(city).enqueue(new Callback - It is said that I must use a query :-/ Here is the message: must not have replace block. For dynamic query parameters use @Query. – Isabelle Jul 06 '16 at 13:17