title: How to send a JSONObject into a Retrofit API call Android
body: <p>I have implemented the first time Retrofit in my Android code and am facing the following issues:</p>
  <blockquote>
  <p>java.lang.IllegalArgumentException: @Body parameters cannot be used with form or multi-part encoding. (parameter #1)</p>
  </blockquote>
  <p>I have implemented my code like below:</p>
  <pre><code>public interface APIService {
      @FormUrlEncoded
      @POST(&quot;/&quot;)
      @Headers({
          &quot;domecode: axys&quot;,
          &quot;Content-Type: application/json;charset=UTF-8&quot;
      })
      Call&lt;JsonObject&gt; sendLocation(@Body JsonObject jsonObject);
  }
  
  
  public class ApiUtils {
  
      static String tempUrl = &quot;http://192.168.16.114:8092/api/v1/location/tsa/&quot;;
      public static APIService getAPIService() {
  
          return RetrofitClient.getClient(tempUrl).create(APIService.class);
      }
  }
  
  public class RetrofitClient {
  
      private static Retrofit retrofit = null;
  
      public static Retrofit getClient(String baseUrl) {
          if(retrofit == null) {
              retrofit = new Retrofit.Builder()
                      .baseUrl(baseUrl)
                      .addConverterFactory(GsonConverterFactory.create())
                      .build();
          }
          return retrofit;
      }
  
  }
  </code></pre>
  <p>Passing the value to an API call</p>
  <pre><code>JsonObject postParam = new JsonObject();
  try {
      postParam.addProperty(Fields.ID, &quot;asdf&quot;);
  }
  
  Call&lt;JsonObject&gt; call = apiService.sendLocation(postParam);
  call.enqueue(
      new Callback&lt;JsonObject&gt;() {
          @Override
          public void onResponse(Call&lt;JsonObject&gt; call, Response&lt;JsonObject&gt; response) {
              Log.d(&quot;response&quot;, &quot;Getting response from server: &quot; + response);
          }
  
          @Override
          public void onFailure(Call&lt;JsonObject&gt; call, Throwable t) {
              Log.d(&quot;response&quot;, &quot;Getting response from server: &quot; + t);
          }
      }
  );
  </code></pre>