@Documented @Target(value=PARAMETER) @Retention(value=RUNTIME) public @interface Query
Values are converted to strings using Retrofit.stringConverter(Type, Annotation[])
(or Object.toString(), if no matching string converter is installed)
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("/friends")
Call<ResponseBody> friends(@Query("page") int page);
Calling with foo.friends(1) yields /friends?page=1.
Example with null:
@GET("/friends")
Call<ResponseBody> friends(@Query("group") String group);
Calling with foo.friends(null) yields /friends.
Array/Varargs Example:
@GET("/friends")
Call<ResponseBody> friends(@Query("group") String... groups);
Calling with foo.friends("coworker", "bowling") yields
/friends?group=coworker&group=bowling.
Parameter names and values are URL encoded by default. Specify encoded=true
to change this behavior.
@GET("/friends")
Call<ResponseBody> friends(@Query(value="group", encoded=true) String group);
Calling with foo.friends("foo+bar")) yields /friends?group=foo+bar.Copyright © 2017 Square, Inc.. All rights reserved.