retrofit / retrofit2.http / QueryName / <init>

<init>

QueryName(encoded: Boolean)

Query parameter appended to the URL that has no value.

Passing a List or array will result in a query parameter for each non-null item.

Simple Example:


  @GET("/friends")
  Call<ResponseBody> friends(@QueryName String filter);
  
Calling with foo.friends("contains(Bob)") yields /friends?contains(Bob).

Array/Varargs Example:


  @GET("/friends")
  Call<ResponseBody> friends(@QueryName String... filters);
  
Calling with foo.friends("contains(Bob)", "age(42)") yields /friends?contains(Bob)&age(42).

Parameter names are URL encoded by default. Specify encoded=true to change this behavior.


  @GET("/friends")
  Call<ResponseBody> friends(@QueryName(encoded=true) String filter);
  
Calling with foo.friends("name+age")) yields /friends?name+age.

See Also
QueryQueryMap