我有一个网络服务链接,我希望以
的形式使用不同的customerId http://apidev.myserver.com.au:8980/TestService/rest/TestService/jobs/bycustid/customerId
如何附加customerId的值?
这是我的基本网址:
http://apidev.myserver.com.au:8980/TestService/rest/TestService/
这就是我的通话界面:
interface CustomerJobs {
@GET("jobs/bycustid/11726")
Call<CustomerJobsPojo> getCustomerJobs();
}
答案 0 :(得分:8)
正如doc所说:
interface CustomerJobs {
@GET("jobs/bycustid/{id}")
Call<CustomerJobsPojo> getCustomerJobs(@Path("id") int id);
}
答案 1 :(得分:3)
尝试@Path
注释
interface CustomerJobs {
@GET("jobs/bycustid/{id}")
Call<CustomerJobsPojo> getCustomerJobs(@Path("id") String id);
}
答案 2 :(得分:3)
你可以嵌入像
@GET("jobs/bycustid/{custId}")
Call<CustomerJobsPojo> groupList(@Path("custId") int custId);
答案 3 :(得分:1)
是的,您可以使用动态网址
interface CustomerJobs {
@GET("jobs/bycustid/{customerid}")
Call<CustomerJobsPojo> getCustomerJobs(@Path("id") int customerid);
}
参考this