What does the @FormUrlEncoded annotation mean in the Retrofit 2.0 library?

There is a code for sending a Post request with the phone and lang fields in the request body. Without FormUrlEncoded, this case doesn't work. What does this annotation mean and why is it needed? I tried to shove the request body in a different way, but it didn't work.

public interface SmsApi {
    @FormUrlEncoded
    @POST("phone_add/{id}")
    Call<PhoneAddModel> phoneAdd(@Path("id") String id,
                           @Field("phone") String phone,
                           @Field("lang") String lang);
}
Author: Роман Кавыршин, 2016-05-11

1 answers

Have you tried to see its description? This annotation defines the eponymous format for transmitting fields in the body of a POST request. Roughly speaking, it writes these fields to the request body in the same format as they would be written to the URL string in a GET request.

 1
Author: xkor, 2016-05-11 22:17:15