With Retrofit 2, you can set the full URL in the service method annotation, for example:
public interface APIService { @GET("http://api.mysite.com/user/list") Call<Users> getUsers(); }
However, in my application, the URL of my web services is unknown at compile time, the application retrieves them in the downloaded file, so I am wondering how I can use Retrofit 2 with a full dynamic URL.
I tried to set the full path, for example:
public interface APIService { @GET("{fullUrl}") Call<Users> getUsers(@Path("fullUrl") fullUrl); } new Retrofit.Builder() .baseUrl("http://api.mysite.com/") .build() .create(APIService.class) .getUsers("http://api.mysite.com/user/list");
But here Retrofit does not see that the path is actually the full URL and is trying to download http://api.mysite.com/http%3A%2F%2Fapi.mysite.com%2Fuser%2Flist
Any hint on how I could use Retrofit with such a dynamic URL?
thank
android retrofit
pdegand59 Sep 14 '15 at 7:29 2015-09-14 07:29
source share