@Documented @Target(value=PARAMETER) @Retention(value=RUNTIME) public @interface QueryMap
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
encoded=true
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.
Modifier and Type | Optional Element and Description |
---|---|
boolean |
encoded
Specifies whether parameter names and values are already URL encoded.
|
Copyright © 2020 Square, Inc.. All rights reserved.