ankushbbbr ankushbbbr - 10 days ago 10x
Android Question

Retrofit error-Missing either @GET URL or @Url parameter

I am working on Youtube API.
The base URL is
Request :GET{search_keyword}&key={API_

ApiService Interface code-

public interface ApiService {
Call<YoutubeResponse> searchVideos(@Query("part") String part,
@Query("q") String q,@Query("key") String apiKey);

The error: java.lang.IllegalArgumentException: Missing either @GET URL or @Url parameter.
in the line of code

Call<YoutubeResponse> call=service.searchVideos("snippet",s, URLConstants.Youtube_API_KEY);

I'm a beginner. Please help!


It's much more semantically correct to use as your base URL and then declare @GET("search/") on your service method.

That said, if you really want your base URL to be the full path you can use @GET(".") to declare that your final URL is the same as your base URL.