Reputation: 587
Link: "www.example.com/getnewcar/?car[color]={colorOfCar}&car[price]={priceOfCar}"
@GET(...)
fun getNewCar(
@Query("car[color]") color: String,
@Query("car[price]") price: String,
...
): Single<JSONApiObject>
I call this function like: b.getNewCar(carColor, carPrice)
URL query string ".." must not have replace block. For dynamic query parameters use @Query. What am I doing wrong? I looked at docs and they suggest using @Query. Can't find what's off tho.
Upvotes: 0
Views: 624
Reputation: 25603
@Query
automatically generates the query part of the URL, so your @GET
annotation should not include it.
Instead of @GET("www.example.com/getnewcar/?car[color]={colorOfCar}&car[price]={priceOfCar}")
it should just be @GET("www.example.com/getnewcar/")
.
Upvotes: 1