Search code examples
androidretrofit

IllegalArgumentException in Retrofit / must not have replace block


I have the following code :

    @GET("api.php?company_name={name}")
    Call<Model> getRoms_center(@Query("name") String name);

According to the official docs, I must use @Query, and i'm using it, but i'm getting the following error :

java.lang.IllegalArgumentException: URL query string "company_name={name}" must not have replace block. For dynamic query parameters use @Query.

Solution

  • You should do it like that instead:

    @GET("api.php")
    Call<Model> getRoms_center(@Query("company_name") String name);