I'm trying to pass multiple Values to a SINGLE parameter for example :
http://api.giphy.com/v1/gifs?api_key=dc6zaTOxFJmzC&ids=feqkVgjJpYtjy,7rzbxdu0ZEXLy
I tried the following :
@GET("gifs")
Call<GIFModelMain> getGifsByID(@Field("ids")ArrayList<String> values, @Query("api_key") String API_KEY);
In my activity :
ArrayList<String> x = new ArrayList<>();
x.add("feqkVgjJpYtjy");
x.add("7rzbxdu0ZEXLy");
gifCall = interf.getGifsByID(x, BuildConfig.GIPHY_API_TOKEN);
But the built URL is of form:
http://api.giphy.com/v1/gifsids=feqkVgjJpYtjy&ids=7rzbxdu0ZEXLy&api_key=API_KEY_BLANK
I looked up similar questions but found no correct answer.
EDIT: As per what TooManyEduardos said i changed my Interface to
@GET("gifs")
Call<GIFModelMain> getGifsByID(@QueryMap Map<String, String> parameters,@Query("api_key") String API_KEY);
And my activity is now :
Map<String,String> map = new HashMap<>();
map.put("ids","feqkVgjJpYtjy");
map.put("ids","7rzbxdu0ZEXLy");
gifCall = interf.getGifsByID(map, BuildConfig.GIPHY_API_TOKEN);
But the built URL is still : 03-30 02:46:23.922: E/FavActivity(21607): Url : api.giphy.com/v1/gifs?ids=7rzbxdu0ZEXLy&api_key=KEY_HERE