Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GET api with Retrofit

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

how do I append the value of customerId?

this is my base URL :

 http://apidev.myserver.com.au:8980/TestService/rest/TestService/

this is what my interface for calls look like :

interface CustomerJobs {
    @GET("jobs/bycustid/11726")
    Call<CustomerJobsPojo> getCustomerJobs();
}
like image 708
Bawa Avatar asked Jun 11 '26 07:06

Bawa


2 Answers

As the doc says :

interface CustomerJobs {

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

}
like image 86
agonist_ Avatar answered Jun 12 '26 22:06

agonist_


Try @Path annotation

interface CustomerJobs {
    @GET("jobs/bycustid/{id}")
    Call<CustomerJobsPojo> getCustomerJobs(@Path("id") String id);
}
like image 35
babedev Avatar answered Jun 12 '26 22:06

babedev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!