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

    1 answer 1

     @POST("index.php?route=feed/web_api/products) Call<ProductList> productList(@Query("category") String category, @Query("other") int other); 

    there will be such a request

     index.php?route=feed/web_api/products&category=category_value&other=othre_value 
    • Thanks, it helped, though the products will load everything, and not a specific category, I will look for a problem in the adapter - yury