title: How to make a POST request using retrofit 2?
body: <p>I was only able to run the hello world example (GithubService) from the docs.   </p>
  
  <p>The problem is when I run my code, I get the following Error, inside of <code>onFailure()</code></p>
  
  <blockquote>
    <p>Use JsonReader.setLenient(true) to accept malformed JSON at line 1
    column 1 path $</p>
  </blockquote>
  
  <p>My API takes POST params value, so no need to encode them as JSON, but it does return the response in JSON.</p>
  
  <p>For the response I got ApiResponse class that I generated using tools.</p>
  
  <p>My interface:</p>
  
  <pre><code>public interface ApiService {
      @POST("/")
      Call&lt;ApiResponse&gt; request(@Body HashMap&lt;String, String&gt; parameters);
  }
  </code></pre>
  
  <p>Here is how I use the service:</p>
  
  <pre><code>HashMap&lt;String, String&gt; parameters = new HashMap&lt;&gt;();
  parameters.put("api_key", "xxxxxxxxx");
  parameters.put("app_id", "xxxxxxxxxxx");
  
  Call&lt;ApiResponse&gt; call = client.request(parameters);
  call.enqueue(new Callback&lt;ApiResponse&gt;() {
      @Override
      public void onResponse(Response&lt;ApiResponse&gt; response) {
          Log.d(LOG_TAG, "message = " + response.message());
          if(response.isSuccess()){
              Log.d(LOG_TAG, "-----isSuccess----");
          }else{
              Log.d(LOG_TAG, "-----isFalse-----");
          }
  
      }
      @Override
      public void onFailure(Throwable t) {
          Log.d(LOG_TAG, "----onFailure------");
          Log.e(LOG_TAG, t.getMessage());
          Log.d(LOG_TAG, "----onFailure------");
      }
  });
  </code></pre>