title: Send Post Request with params using Retrofit
body: <p>I'm trying unsuccessfully to consume an API on Android using Retrofit library but while using POSTMAN I can see the expected results. </p>
  
  <p><strong>POSTMAN SETTING</strong></p>
  
  <ul>
  <li><p>The api url (base+controller)</p></li>
  <li><p>HTTP Method set to POST </p></li>
  <li><p>Clicked the from-data or x-www-form-urlencoded </p></li>
  <li><p>Then i pass the two params on the key/value fields.  </p></li>
  </ul>
  
  <p><strong>ANDROID RETROFIT SETTING</strong></p>
  
  <pre><code>@POST("/GetDetailWithMonthWithCode")
  void getLandingPageReport(@Query("code") String code,
                            @Query("monthact") String monthact,
                            Callback&lt;LandingPageReport&gt; cb);
  
  @FormUrlEncoded
  @POST("/GetDetailWithMonthWithCode")
  void getLandingPageReport(@Field("code") String code,
                            @Field("monthact") String monthact,
                            Callback&lt;LandingPageReport&gt; cb);
  </code></pre>
  
  <p>None of this options works. But am getting {} as result.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Same settings by using the standard <code>HttpClient</code>(and <code>HttpPost</code>) class works fine.</p>
  
  <pre><code>HttpClient client = new DefaultHttpClient();
  HttpPost post = new HttpPost(url);
  
  List&lt;NameValuePair&gt; urlParameters = new ArrayList&lt;NameValuePair&gt;();
  urlParameters.add(new BasicNameValuePair("code", "testcode"));
  urlParameters.add(new BasicNameValuePair("monthact", "feb-2015"));
  
  post.setEntity(new UrlEncodedFormEntity(urlParameters));
  
  HttpResponse response = client.execute(post);
  </code></pre>
  
  <p>Why I can't do this request and get the correct response in Retrofit?</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <pre><code>@POST("/GetDetailWithMonthWithCode")
  void getLandingPageReport(@Query("code") String code,
                            @Query("monthact") String monthact,
                            Callback&lt;List&lt;LandingPageReport&gt;&gt; cb);
  
  @FormUrlEncoded
  @POST("/GetDetailWithMonthWithCode")
  void getLandingPageReport(@Field("code") String code,
                            @Field("monthact") String monthact,
                            Callback&lt;List&lt;LandingPageReport&gt;&gt;&gt; cb);
  </code></pre>
  
  <p>After playing around I think I've found the source of the problem. I've updated my retrofit code to receive <code>List&lt;LandingPageReport&gt;</code>. But now this error occur</p>
  
  <blockquote>
    <p>retrofit.RetrofitError: com.google.gson.JsonSyntaxException:
    java.lang.IllegalStateException: Expected BEGIN_ARRAY but was
    BEGIN_OBJECT at line 1 column 2 path $</p>
  </blockquote>
  
  <p>The reason is that i consume 2 api's (webapi and wcf). All my other <code>json</code> response are arrays of objects. [{},{}]  but in this call I've received this </p>
  
  <pre><code>{
    "GetDetailWithMonthWithCodeResult": [
       {
          "code": "test",
          "field1": "test",
       }
     ]
  }
  </code></pre>
  
  <p>But still I can't manage to parse the response.</p>