title: Retrofit 2 with only form-data
body: <p>I am trying to make POST request using the Retrofit 2. The request type is <code>form-data</code> <strong>NOT</strong> <code>application/x-www-form-urlencoded</code>.</p>
  
  <p>I am only posting data not the files in the request and the response is in the form of JSON.</p>
  
  <p>I have tried <code>@FormUrlEncoded, @Multipart</code> but it is not working. </p>
  
  <p>I have tried following request</p>
  
  <p><strong>1. First Attempt</strong></p>
  
  <pre><code>@FormUrlEncoded
  @POST("XXXX")
  Call&lt;PlanResponse&gt; getPlanName(@Field(Constants.ACTION_ID) String actionId, @Field(Constants.OFFER_CODE) String offerCode);
  </code></pre>
  
  <p><strong>2. Second Attempt</strong></p>
  
  <pre><code>@Headers({"Content-Type: multipart/form-data","Content-Type: text/plain"})
  @FormUrlEncoded
  @POST("XXXX")
  Call&lt;PlanResponse&gt; getPlans(@Body @FieldMap(encoded = false) Map&lt;String, String&gt; data);
  </code></pre>
  
  <p><strong>3. Third Attempt</strong></p>
  
  <pre><code>@Headers("Content-Type: multipart/form-data")
  @Multipart
  @POST("XXXX")
  Call&lt;PlanResponse&gt; myPlans(@Part(Constants.ACTION_ID) String actionId, @Part(Constants.OFFER_CODE) String offerCode);
  </code></pre>
  
  <p>I am only getting the body as <strong>null</strong>. It is working with the POSTMAN.</p>
  
  <p>I have also search about <code>form-data</code> and <code>application/x-www-form-urlencoded</code> and found that if the data is binary then use <code>form-data</code> and if data is ASCII then use <code>application/x-www-form-urlencoded</code></p>
  
  <p>I am trying find <strong>Is form-data is not supported by the Retrofit?</strong> </p>
  
  <p>POSTMAN request</p>
  
  <pre><code>Cache-Control: no-cache
  Postman-Token: XXXXXXXXXXXX-XXXXXXXXXXXX-XXXXXXXXXXXX-XXXXXXXXXXXX-XXXXXXXXXXXX
  Content-Type: multipart/form-data; boundary=----    WebKitFormBoundaryXXXXXXXXXXXX
  
  
   ----WebKitFormBoundaryXXXXXXXXXXXX
  Content-Disposition: form-data; name="actionId"
  
  1000
   ----WebKitFormBoundaryXXXXXXXXXXXX
  Content-Disposition: form-data; name="offerCode"
  
  MYCODE
  ----WebKitFormBoundaryXXXXXXXXXXXX
  </code></pre>
  
  <p>I can only add HTTP Generated code snipped from POSTMAN</p>