I have following url http://54.169.227.89:90/DataAccessService.svc/GetProducts/2 which i wanted to use i retrofit get method How to append 2 which is company id which i get from sharepreference during login
Here is ma interface code
public interface ProductsGet {
String Company_id = OrderApplication.CompanyID_New;
@GET("/DataAccessService.svc/GetProducts/")
public void getProducts( Callback<List<ProductsNew>> response);
}
In order to make end point dynamic either you can implementing Endpoint
and make use of setUrl()
or you can use URL manipulation block which is surrounded by {
and }
.
int Company_id = OrderApplication.CompanyID_New;
public interface ProductsGet {
@GET("/DataAccessService.svc/GetProducts/{COMPANY_ID}")
public void getProducts(@Path("COMPANY_ID") String Company_id, Callback<List<ProductsNew>> response);
yourreference.getProducts(company_id,new Callback...)