上記のように、私は改造のためのAPIインタフェースを構築する必要があります。これは私のURLです:改造のためのAPIインターフェイスを作成するには?
https://api.flightstats.com/flex/weather/rest/v1/json/all/COK?appId=XXXXXXXXX&appKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&codeType=IATA
//--------------------------------------------------------^^^--------------------------------------------------------------------
上記マークとして、問題は、空港コードの位置COK
、である、と私は、要求にそれを渡す必要があり、しかし、私は私の実装でそれを渡すことができません改造のインターフェイス作成のこれは私のコードです:
WeatherApiClient.class
public class WeatherApiClient {
public static final String BASE_URL = "https://api.flightstats.com/flex/weather/rest/v1/json/all/";
private static Retrofit retrofit = null;
public static Retrofit getClient() {
if (retrofit==null) {
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
}
ながら、私はまた、空港のコードを渡すことができるように私は私のコードを変更する必要がありますどのようにWeatherApiInterface.class
public interface WeatherApiInterface {
@GET("COK") // this should be dynamic
Call<WeatherPojo> getValues(@Query("appId") String appId, @Query("appKey") String key, @Query("codeType") String code);
}
リクエスト?
私は改装についてよく分かりませんが、getValues()に "COK"を追加する方法はありますか?そして、あなたは位置のための質問キーが必要です。 (それはクエリ文字列でsomeKey = COKでなければなりません) – Toris
おそらく@Get( "。")かそのようなものです。 – Toris