@Documented @Target(value=PARAMETER) @Retention(value=RUNTIME) public @interface Query
Values are converted to strings using String.valueOf(Object) and then URL encoded.
null values are ignored. Passing a List or array will result in a
query parameter for each non-null item.
Simple Example:
@GET("/list")
Call<ResponseBody> list(@Query("page") int page);
Calling with foo.list(1) yields /list?page=1.
Example with null:
@GET("/list")
Call<ResponseBody> list(@Query("category") String category);
Calling with foo.list(null) yields /list.
Array/Varargs Example:
@GET("/list")
Call<ResponseBody> list(@Query("category") String... categories);
Calling with foo.list("bar", "baz") yields
/list?category=bar&category=baz.
Parameter names and values are URL encoded by default. Specify encoded=true
to change this behavior.
@GET("/search")
Call<ResponseBody> list(@Query(value="foo", encoded=true) String foo);
Calling with foo.list("foo+bar")) yields /search?foo=foo+bar.QueryMapCopyright © 2016 Square, Inc.. All rights reserved.