@Documented
@Target(value=PARAMETER)
@Retention(value=RUNTIME)
public @interface Field
Values are converted to strings using String.valueOf(Object)
and then form URL encoded.
null
values are ignored. Passing a List
or array will result in a
field pair for each non-null
item.
Simple Example:
@FormUrlEncoded @POST("/") void example(@Field("name") String name, @Field("occupation") String occupation); }Calling with
foo.example("Bob Smith", "President")
yields a request body of
name=Bob+Smith&occupation=President
.
Array Example:
@FormUrlEncoded @POST("/list") void example(@Field("name") String... names);Calling with
foo.example("Bob Smith", "Jane Doe")
yields a request body of
name=Bob+Smith&name=Jane+Doe
.FormUrlEncoded
,
FieldMap
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
value |