Search code examples
kotlinretrofit2

using retrofit to make url?locations=lat,lon query


I'm trying to make a get query that has to look like this: url?locations=lat,lon

I tried this code :

@Query("locations") lat: List<Double>

but this ends up with url?locations=lat&lon

any idea how can I do to attain this url?


Solution

  • I think that you will only achieve what you want using the solution BakhtiyorBegmatov mentioned:

    @GET("locations")
    suspend fun getLocations(
       @Query("locations") latLongString: String
    ) : List<Location>