retrofit / retrofit2.http / QueryMap / <init>

<init>

QueryMap(encoded: Boolean)

Query parameter keys and values appended to the URL.

Values are converted to strings using Retrofit#stringConverter(Type, Annotation[]) (or Object#toString(), if no matching string converter is installed).

Simple Example:


  @GET("/friends")
  Call<ResponseBody> friends(@QueryMap Map<String, String> filters);
  
Calling with foo.friends(ImmutableMap.of("group", "coworker", "age", "42")) yields /friends?group=coworker&age=42.

Map keys and values representing parameter values are URL encoded by default. Specify to change this behavior.


  @GET("/friends")
  Call<ResponseBody> friends(@QueryMap(encoded=true) Map<String, String> filters);
  
Calling with foo.list(ImmutableMap.of("group", "coworker+bowling")) yields /friends?group=coworker+bowling.

A null value for the map, as a key, or as a value is not allowed.

See Also
QueryQueryName