如何将 int 值附加到 android 中改造的 GET url
how to append int value to GET url of retrofit in android
我有关注url
http://54.169.227.89:90/DataAccessService.svc/GetProducts/2
我想用它来改造 get 方法
如何附加 2,这是我在登录期间从 sharepreference 获得的公司 ID
这是ma接口代码
public interface ProductsGet {
String Company_id = OrderApplication.CompanyID_New;
@GET("/DataAccessService.svc/GetProducts/")
public void getProducts( Callback<List<ProductsNew>> response);
}
为了使端点动态化,您可以实现 Endpoint
并使用 setUrl()
,或者您可以使用 URL 被 {
包围的操作块和 }
.
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...)
Call<IndentsPojo> call1 = apiInterface.getReport("Basic YWRtaW46MTIzNA==", 1, 10,
"",
"", "", "",
"01-Jan-2018", "06-Mar-2019");
@GET("Indent/IndentVsIssueReport?")// TODO GET CALL HERE
Call<IndentsPojo> getReports(@Header("Authorization") String token,
@Query("pageNumber") int pageNumber,
@Query("pageSize") int pageSize,
@Query("quickSearch") String quickSearch,
@Query("indentNo") String indentNo,
@Query("distilleryid") String distilleryid,
@Query("brandcategoryid") String brandcategoryid,
@Query("IssueFromDate") String fromDate,
@Query("IssueToDate") String toDate
);
我有关注url http://54.169.227.89:90/DataAccessService.svc/GetProducts/2 我想用它来改造 get 方法 如何附加 2,这是我在登录期间从 sharepreference 获得的公司 ID
这是ma接口代码
public interface ProductsGet {
String Company_id = OrderApplication.CompanyID_New;
@GET("/DataAccessService.svc/GetProducts/")
public void getProducts( Callback<List<ProductsNew>> response);
}
为了使端点动态化,您可以实现 Endpoint
并使用 setUrl()
,或者您可以使用 URL 被 {
包围的操作块和 }
.
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...)
Call<IndentsPojo> call1 = apiInterface.getReport("Basic YWRtaW46MTIzNA==", 1, 10,
"",
"", "", "",
"01-Jan-2018", "06-Mar-2019");
@GET("Indent/IndentVsIssueReport?")// TODO GET CALL HERE
Call<IndentsPojo> getReports(@Header("Authorization") String token,
@Query("pageNumber") int pageNumber,
@Query("pageSize") int pageSize,
@Query("quickSearch") String quickSearch,
@Query("indentNo") String indentNo,
@Query("distilleryid") String distilleryid,
@Query("brandcategoryid") String brandcategoryid,
@Query("IssueFromDate") String fromDate,
@Query("IssueToDate") String toDate
);