I use Retrofit 2.0. I don’t manage to create a query. My interface
public interface ProductListService { @POST("index.php?route=feed/web_api/products&category={id}&key=***") Call<ProductList> productList(@Query("id") String id); } service creation:
@NonNull public static ProductListService getProductsListService(/*final String id*/) { /*CLIENT.interceptors().add(new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = chain.request(); HttpUrl url = request.httpUrl().newBuilder().addQueryParameter("id",id).build(); request = request.newBuilder().url(url).build(); return chain.proceed(request); } });*/ return getRetrofit().create(ProductListService.class); } @NonNull private static Retrofit getRetrofit() { return new Retrofit.Builder() .baseUrl("http://site.net/") .addConverterFactory(GsonConverterFactory.create()) .client(CLIENT) .build(); } in the loader
ProductListService service = ApiFactory.getProductsListService(); Call<ProductList> call = service.productList(id); ProductList body = call.execute().body(); I need to change the category id. Also tried @Path annotation, no result