title: Retrofit how to pass paramiters inside the GET string
body: <p>I am trying to get weather data by passing the current latitude and longitude. How can I pass these two variable in the Retrofit Get Query string? </p>
  
  <p>Please check below code, I want replace the <code>{lat}</code> and <code>{lon}</code> with the value I pass</p>
  
  <pre><code>@GET("yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22({lat},{lon})%22)&amp;format=json&amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys")
  Call&lt;YahooWeather&gt; getWeatherData(@Path("lat") String lat, @Path("lon") String lon);
  </code></pre>
  
  <p>Here is my Client interface <code>YahooWeatherClient.java</code></p>
  
  <pre><code>public interface YahooWeatherClient {
      @GET("yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22({lat},{lon})%22)&amp;format=json&amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys")
      Call&lt;YahooWeather&gt; getWeatherData(@Path("lat") String lat, @Path("lon") String lon);
  }
  </code></pre>
  
  <p>Here is the Activity <code>RetrofitActivity.java</code></p>
  
  <pre><code>public class RetrofitActivity extends AppCompatActivity {
      private static final String TAG = RetrofitActivity.class.getSimpleName();
      YahooWeatherClient mYahooWeatherClient;
  
      TextView messageTV;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_retrofit);
  
          messageTV = (TextView) findViewById(R.id.message);
  
          initializeRetrofit();
          getWeatherData();
      }
  
      private void initializeRetrofit() {
          String BASE_URL = "https://query.yahooapis.com/v1/public/";
  
          Retrofit retrofit = new Retrofit.Builder()
                  .baseUrl(BASE_URL)
                  .addConverterFactory(GsonConverterFactory.create())
                  .build();
  
          mYahooWeatherClient = retrofit.create(YahooWeatherClient.class);
      }
  
      private void getWeatherData() {
          Call&lt;YahooWeather&gt; weatherCall = mYahooWeatherClient.getWeatherData("23.780833", "90.349417");
          weatherCall.enqueue(new Callback&lt;YahooWeather&gt;() {
              @Override
              public void onResponse(Call&lt;YahooWeather&gt; call, Response&lt;YahooWeather&gt; response) {
                  YahooWeather weather = response.body();
                  messageTV.setText(weather.getQuery().getResults().getChannel().getAstronomy().getSunrise());
                  Log.d(TAG, weather.getQuery().getResults().getChannel().getAstronomy().getSunrise());
  
              }
  
              @Override
              public void onFailure(Call&lt;YahooWeather&gt; call, Throwable t) {
                  messageTV.setText(t.getMessage());
                  Log.e(TAG, t.getMessage());
              }
          });
      }
  
  }
  </code></pre>
  
  <p>Error Log:</p>
  
  <pre><code>                  --------- beginning of crash
  E/AndroidRuntime: FATAL EXCEPTION: main
                    Process: net.deviac.retrofitsample, PID: 3576
                    java.lang.RuntimeException: Unable to start activity ComponentInfo{net.deviac.retrofitsample/net.deviac.retrofitsample.RetrofitActivity}: java.lang.IllegalArgumentException: URL query string "q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22({lat},{lon})%22)&amp;format=json&amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys" must not have replace block. For dynamic query parameters use @Query.
                        for method YahooWeatherClient.getWeatherData
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
                        at android.app.ActivityThread.access$800(ActivityThread.java:151)
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
                        at android.os.Handler.dispatchMessage(Handler.java:102)
                        at android.os.Looper.loop(Looper.java:135)
                        at android.app.ActivityThread.main(ActivityThread.java:5254)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at java.lang.reflect.Method.invoke(Method.java:372)
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
                     Caused by: java.lang.IllegalArgumentException: URL query string "q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22({lat},{lon})%22)&amp;format=json&amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys" must not have replace block. For dynamic query parameters use @Query.
                        for method YahooWeatherClient.getWeatherData
                        at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:720)
                        at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:711)
                        at retrofit2.ServiceMethod$Builder.parseHttpMethodAndPath(ServiceMethod.java:297)
                        at retrofit2.ServiceMethod$Builder.parseMethodAnnotation(ServiceMethod.java:242)
                        at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:170)
                        at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:166)
                        at retrofit2.Retrofit$1.invoke(Retrofit.java:145)
                        at java.lang.reflect.Proxy.invoke(Proxy.java:397)
                        at $Proxy0.getWeatherData(Unknown Source)
                        at net.deviac.retrofitsample.RetrofitActivity.getWeatherData(RetrofitActivity.java:45)
                        at net.deviac.retrofitsample.RetrofitActivity.onCreate(RetrofitActivity.java:30)
                        at android.app.Activity.performCreate(Activity.java:5990)
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
                          ... 10 more
  </code></pre>