【发布时间】:2020-08-11 07:59:42
【问题描述】:
我正在尝试从电影 api 中获取一些数据。我尝试像往常一样进行改造,但第二个参数出现错误。可能是因为字符串参数视频(在生成Json文件的链接中)不是“变量”参数,所以可能没有识别调用。
服务:
public interface Service {
@GET("/3/movies/{id}")
Call<TrailerResponse> getVideos (
@Path("id") int id,
String videos,
@Query("api_key") String apiKey,
@Query("language") String language
);
}
加载(getVideos 中的变量我认为指定并不重要)
public static List<Videos> load() {
Service apiService = Client.getClient().create(Service.class);
Call<TrailerResponse> call;
call = apiService.getVideos(ID, VIDEOS, API_KEY, LANGUAGE);
if(call == null){
return null;
}
【问题讨论】:
标签: android json api android-studio retrofit2