@Documented
@Target(value=PARAMETER)
@Retention(value=RUNTIME)
public static @interface Retrofit.Field
@FormUrlEncoded @POST(@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.Retrofit.FormUrlEncoded,
Retrofit.FieldMap| Modifier and Type | Required Element and Description |
|---|---|
java.lang.String |
value |
| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
encodeName
Specifies whether
value() is URL encoded. |
boolean |
encodeValue
Specifies whether the argument value to the annotated method parameter is URL encoded.
|
public abstract boolean encodeName
value() is URL encoded.