I have to execute the following API call
URL https://devipapi.octavehi.com/api/state/select-list-items?countryId=236
The retrofit function I create is
@GET("country/state/select-list-items?")
suspend fun fetchStates(@Query("countryId") id: Int): Response<List<ServerState>>
But I get this URL returned from retrofit
https://devipapi.octavehi.com/api/country/state/select-list-items?&countryId=236
ampercent (&) get appended along with ?
How to fix this?
CodePudding user response:
Remove '?' from the @GET
@GET("country/state/select-list-items")
suspend fun fetchStates(@Query("countryId") id: Int): Response<List<ServerState>>
CodePudding user response:
Solved by
@GET("city/select-list-items")
suspend fun fetchCities(@Query(value="stateId", encoded = true) id: Int): Response<List<ServerCity>>