使用 Retrofit 获取 api [英] GET api with Retrofit

查看:55
本文介绍了使用 Retrofit 获取 api的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Web 服务链接,我想以

I have a web service link which I want to hit with different customerId in the form of

 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();
}

推荐答案

正如 doc 所说:

interface CustomerJobs {

    @GET("jobs/bycustid/{id}")
    Call<CustomerJobsPojo> getCustomerJobs(@Path("id") int id);

}

这篇关于使用 Retrofit 获取 api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆