GET 改造
GET in retrofit
我正在尝试使用改造,但我无法弄清楚如何使用 @GET() 来执行以下操作
我有两个 1)。 url1 :www.url.com/a/b 和 2)。 url2:www.url.com/c/d
我已将基础 url 设置为 www.url.com 但我无法弄清楚如何在 @get 方法
中设置 url 的其余部分
public interface API {
@GET(details1)
Call<Response1> List1();
@GET(details2)
Call<Response2> List2();
首先你应该像这样把你的基础 URL 放在 Retrofit 实例中:
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://www.url.com /")
.build();
然后在这里继续link:
@GET("c/d")
Call<Response1> getResponse1();
我也建议你阅读这篇文章link
我正在尝试使用改造,但我无法弄清楚如何使用 @GET() 来执行以下操作 我有两个 1)。 url1 :www.url.com/a/b 和 2)。 url2:www.url.com/c/d 我已将基础 url 设置为 www.url.com 但我无法弄清楚如何在 @get 方法
中设置 url 的其余部分
public interface API {
@GET(details1)
Call<Response1> List1();
@GET(details2)
Call<Response2> List2();
首先你应该像这样把你的基础 URL 放在 Retrofit 实例中:
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://www.url.com /")
.build();
然后在这里继续link:
@GET("c/d")
Call<Response1> getResponse1();
我也建议你阅读这篇文章link