title: Retrofit 2.0 throwing "IllegalArgumentException: @Field parameters can only be used with form encoding". How to do right API query and fix it?
body: <p>My problem is that <strong>I don't know how to start using Retrofit 2.0 with received API</strong> - mentioned below...</p>
  
  <p>Firstly, I need to username, password, fbID (optional), gmailID (optional), twitID (optional), gender, birthDate, location (not required - if long and lat has values), longitude (optional), latitude (optional), profileImage (optional).</p>
  
  <p>When all parameters are good - receive <code>status = true</code>. 
  If not - receive <code>status = false</code> and required parameters which are wrong (e.g. mail is already taken)</p>
  
  <p>So I can receive 
  <code>status = true</code> 
  or 
  <code>status = false</code> and array with max 5 parameters (username, email, password, gender, birthDate).</p>
  
  <p>I tried this <code>API Interface</code>:</p>
  
  <pre><code>public interface AuthRegisterUserApi {
      @PUT()
      Call&lt;AuthRegisterUserModel&gt; getStatus(
              @Field("username") String username,
              @Field("email") String email,
              @Field("password") String password,
              @Field("fbID") String fbID,
              @Field("gmailID") String gmailID,
              @Field("twitID") String twitID,
              @Field("gender") String gender,
              @Field("birthDate") String birthDate,
              @Field("location") String location,
              @Field("longitude") String longitude,
              @Field("latitude") String latitude,
              @Field("profileImage") String profileImage
              );
  
      class Factory {
          private static AuthRegisterUserApi service;
  
          public static AuthRegisterUserApi getInstance() {
              Retrofit retrofit = new Retrofit.Builder()
                      .baseUrl(ApiConstants.REGISTER_URL)
                      .addConverterFactory(GsonConverterFactory.create())
                      .build();
  
              service = retrofit.create(AuthRegisterUserApi.class);
  
              return service;
          }
      }
  }
  </code></pre>
  
  <p><a href="http://pastebin.com/7X5D0NjL" rel="noreferrer">with this API models (Pastebin.com)</a></p>
  
  <p>and this code in <code>Activity</code>:</p>
  
  <pre><code>AuthRegisterUserApi.Factory.getInstance()
          .getStatus(
                  usernameEditText.getText().toString(),
                  emailEditText.getText().toString(),
                  passwordEditText.getText().toString(),
                  "", "", "",
                  (maleRadioButton.isChecked() ? "male" : "female"),
                  mYear + "-" + mMonth+1 + "-" + mDay,
                  (geoLocationToggleButton.isChecked() ? geoLocationEditText.getText().toString() : ""),
                  (!geoLocationToggleButton.isChecked() ? "50" : ""),
                  (!geoLocationToggleButton.isChecked() ? "50" : ""),
                  "")
          .enqueue(new Callback&lt;AuthRegisterUserModel&gt;() {
      @Override
      public void onResponse(Call&lt;AuthRegisterUserModel&gt; call, Response&lt;AuthRegisterUserModel&gt; response) {
          if(response.isSuccessful()) {
              if (response.body().isStatus()) {
                  showToast(getApplicationContext(), "Registration ok.");
              } else {
                  response.body().getInfo().getUsername();
              }
          }
      }
  
      @Override
      public void onFailure(Call&lt;AuthRegisterUserModel&gt; call, Throwable t) {
  
      }
  });
  </code></pre>
  
  <p>I have error: <code>java.lang.IllegalArgumentException: @Field parameters can only be used with form encoding. (parameter #1) for method AuthRegisterUserApi.getStatus</code></p>
  
  <p>I tried to register user using Postman and it works when I used option <code>Body</code> -> <code>x-www-form-urlencoded</code>.</p>
  
  <p><strong>How can I create I <code>register</code> query to this API?</strong> Change <code>@Field</code> to something else? I have got this error always...</p>
  
  <p><strong>EDIT: Need to change <code>API Interface</code> to this</strong>:</p>
  
  <pre><code>public interface AuthRegisterUserApi {
      @FormUrlEncoded
      @PUT("/api/register")
      Call&lt;AuthRegisterUserModel&gt; getStatus(
              @Field("username") String username,
              @Field("email") String email,
              @Field("password") String password,
              @Field("fbID") String fbID,
              @Field("gmailID") String gmailID,
              @Field("twitID") String twitID,
              @Field("gender") String gender,
              @Field("birthDate") String birthDate,
              @Field("location") String location,
              @Field("longitude") String longitude,
              @Field("latitude") String latitude,
              @Field("profileImage") String profileImage
              );
  
      class Factory {
          private static AuthRegisterUserApi service;
  
          public static AuthRegisterUserApi getInstance() {
              Retrofit retrofit = new Retrofit.Builder()
                      .baseUrl(ApiConstants.BASE_URL)
                      .addConverterFactory(GsonConverterFactory.create())
                      .build();
  
              service = retrofit.create(AuthRegisterUserApi.class);
  
              return service;
          }
      }
  }
  </code></pre>
  
  <p><code>BASE_URL = http://ip_address:8400</code> for me...</p>
  
  <p>But still got error: <code>Response.rawResponse = Response{protocol=http/1.1, code=400, message=Bad Request, url=http://ip_address:8400/api/register}</code>. Using Postman with the same data I received code=201 Created. <strong>Don't know why...</strong></p>