@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 |
|---|---|
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.
|
Copyright © 2015 Square, Inc.. All Rights Reserved.