Cristian Cam G
Cristian Cam G

Reputation: 362

retrofit using more than one variable in @path

i'm trying to send a request using multiple variables in the url like the following code

@GET("rides/getride/{user}/{lat_orig}%2C{lon_orig}/{lat_dest}%2C{lon_dest}/")
        Call<User> getride(@Path("user") String user,@Path("lat_orig") double lat_orig,@Path("long_orig") double lon_orig,
                @Path("lat_dest") double lat_dest,@Path("lon_dest") double lon_dest);

but its throwing me an error. is there another way to do it? do i ahve to enter one by one and then send it all together?

Upvotes: 0

Views: 1132

Answers (1)

iagreen
iagreen

Reputation: 32016

The error message can really help guide to what is wrong. There error you are getting is --

URL "rides/getride/{user}/{lat_orig}%2C{lon_orig}/{lat_dest}%2C{lon_dest}/" does not contain "{long_orig}". (parameter #3)

From that, we can see that the issue is in your url you have "lon_orig" (no g) and in your Path annotation you have -- "long_orig" (with a g). Change one or the other so they match.

Upvotes: 1

Related Questions