Why does retrofit want me to use Query

Viewed 54

I am getting the following error: Caused by:

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

I have tried to following the documentation for dynamic questions and this seems to be the way to do it.

I have also tried using the @Query tag but with no luck.

This is my request:

@GET("filter.php?c={category}")
fun getRecipesForCategory(@Path("category") categoryName: String): Single<Meals>
1 Answers

you have to use @Query keyword to add query to a request

@GET("filter.php")
fun getRecipesForCategory( @Query("c") String queryParameter): Single<Meals>

this will be translated to

www.yourBaseURl.com/filter.php?c=queryParameter

Related