title: Rest Assured: POST request example (help)
body: <p>I want to create <strong>POST</strong> request with <strong>REST Assured</strong>. But i can't find a useful guide on the Internet. Could someone share a good guide (video) or help me to create correct request?</p>
  
  <p>I want to send next request. See <a href="https://i.stack.imgur.com/BZt7p.png" rel="nofollow noreferrer">request in Fiddler</a></p>
  
  <p>I've created next code. See <a href="https://i.stack.imgur.com/x0lV0.png" rel="nofollow noreferrer">request using Rest Assured</a></p>
  
  <p>I'm sure it's wrong. So maybe someone will help me )</p>
  
  <p>My code:</p>
  
  <pre><code>public static void nextApp(){
      RestAssured.config = RestAssured.config().encoderConfig(encoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false));
      Response response = given()
              .header("X-Instance-ID", "e2HAWV98vQE:APA91bFU4l4pKKxlpJBDD5IdQXnTMOCrOt7q8muVXW8Qm5uoBvGiBUxjdidq-gVuNtNs9kI5HD3RhDSKUQJAT0UZSNYeYHS2dkewvt974Q0CfgLu02vRaRZj7t75x2Tga4RR3MnxyALC")
              .header("X-Requested-With", "XMLHttpRequest")
              .header("Accept-Language", "en-us")
              .header("Accept-Encoding", "gzip, deflate")
              .header("Content-Type", "application/x-www-form-urlencoded")
              .header("Origin", "https://minsk.nextapp.by")
              .header("X-Device-Token", "AC28F645-ECB6-49A6-AFD6-AE0CD9C1BF58")
              .header("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 NextApp/4.3.8")
              .header("Referer", "https://minsk.nextapp.by/?utm_medium=mobile&amp;utm_source=ios&amp;utm_campaign=4.3")
              .header("Connection", "keep-alive")
              .header("Cookie", "io=GybCh81QRgEyoiZpABzk; _ga=GA1.2.977356556.1494829849; _gid=GA1.2.1823073921.1504425333; __cfduid=d53f5a62b6c9edde5756dfe595171c83f1504425330")
              .body("lang=ru&amp;multiplier=&amp;address%5B0%5D%5Bline%5D=%D0%9D%D0%B0%D0%B3%D0%BE%D1%80%D0%BD%D0%B0%D1%8F+%D1%83%D0%BB.+2&amp;address%5B0%5D%5Bcoords%5D=53.9471%2C27.42119&amp;address%5B0%5D%5Bregion%5D=%D0%B0%D0%B3%D1%80%D0%BE%D0%B3%D0%BE%D1%80%D0%BE%D0%B4%D0%BE%D0%BA+%D0%96%D0%B4%D0%B0%D0%BD%D0%BE%D0%B2%D0%B8%D1%87%D0%B8%2C+%D0%96%D0%B4%D0%B0%D0%BD%D0%BE%D0%B2%D0%B8%D1%87%D1%81%D0%BA%D0%B8%D0%B9+%D1%81%D0%B5%D0%BB%D1%8C%D1%81%D0%BE%D0%B2%D0%B5%D1%82%2C+%D0%9C%D0%B8%D0%BD%D1%81%D0%BA%D0%B8%D0%B9+%D1%80%D0%B0%D0%B9%D0%BE%D0%BD%2C+%D0%9C%D0%B8%D0%BD%D1%81%D0%BA%D0%B0%D1%8F+%D0%BE%D0%B1%D0%BB%D0%B0%D1%81%D1%82%D1%8C%2C+%D0%91%D0%B5%D0%BB%D0%B0%D1%80%D1%83%D1%81%D1%8C&amp;address%5B0%5D%5Bnotes%5D=&amp;address%5B0%5D%5Bstreet%5D=&amp;address%5B1%5D%5Bline%5D=&amp;address%5B1%5D%5Bcoords%5D=&amp;address%5B1%5D%5Bregion%5D=&amp;address%5B1%5D%5Bnotes%5D=&amp;address%5B1%5D%5Bstreet%5D=&amp;tariff=STANDARD&amp;dateOffset=-1&amp;coupon=&amp;phone=%2B375447276177&amp;customer=%D0%A1%D0%B2%D0%B5%D1%82%D0%B0&amp;payment=")
              .baseUri("https://minsk.nextapp.by/order")
              .post();
      System.out.println(response.body().asString());
  }
  
  public static void main(String[] args) {
      nextApp();
  }
  </code></pre>
  
  <p>When i'm trying to execute code, next error occurs:</p>
  
  <pre><code>08:59:30.242 [main] DEBUG org.apache.http.impl.conn.BasicClientConnectionManager - Get connection for route {s}-&gt;https://minsk.nextapp.by:443
  08:59:30.296 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnectionOperator - Connecting to minsk.nextapp.by:443
  Exception in thread "main" javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
  at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
  at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
  at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2023)
  at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1125)
  at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
  at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
  at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
  at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:543)
  at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:409)
  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
  at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
  at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
  at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)
  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
  at org.apache.http.client.HttpClient$execute$0.call(Unknown Source)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
  at com.jayway.restassured.internal.RequestSpecificationImpl$RestAssuredHttpBuilder.doRequest(RequestSpecificationImpl.groovy:1974)
  at com.jayway.restassured.internal.http.HTTPBuilder.post(HTTPBuilder.java:341)
  at com.jayway.restassured.internal.http.HTTPBuilder$post$2.call(Unknown Source)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
  at com.jayway.restassured.internal.RequestSpecificationImpl.sendRequest(RequestSpecificationImpl.groovy:1159)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
  at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1210)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:810)
  at com.jayway.restassured.internal.RequestSpecificationImpl.invokeMethod(RequestSpecificationImpl.groovy)
  at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:48)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:149)
  at com.jayway.restassured.internal.filter.SendRequestFilter.filter(SendRequestFilter.groovy:30)
  at com.jayway.restassured.filter.Filter$filter$0.call(Unknown Source)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
  at com.jayway.restassured.filter.Filter$filter.call(Unknown Source)
  at com.jayway.restassured.internal.filter.FilterContextImpl.next(FilterContextImpl.groovy:73)
  at com.jayway.restassured.filter.time.TimingFilter.filter(TimingFilter.java:56)
  at com.jayway.restassured.filter.Filter$filter.call(Unknown Source)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
  at com.jayway.restassured.internal.filter.FilterContextImpl.next(FilterContextImpl.groovy:73)
  at com.jayway.restassured.filter.FilterContext$next.call(Unknown Source)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
  at com.jayway.restassured.internal.RequestSpecificationImpl.applyPathParamsAndSendRequest(RequestSpecificationImpl.groovy:1596)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
  at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1210)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:810)
  at com.jayway.restassured.internal.RequestSpecificationImpl.invokeMethod(RequestSpecificationImpl.groovy)
  at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:48)
  at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:58)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
  at com.jayway.restassured.internal.RequestSpecificationImpl.post(RequestSpecificationImpl.groovy:164)
  at com.jayway.restassured.internal.RequestSpecificationImpl.post(RequestSpecificationImpl.groovy)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
  at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1210)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:810)
  at com.jayway.restassured.internal.RequestSpecificationImpl.invokeMethod(RequestSpecificationImpl.groovy)
  at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:48)
  at org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:58)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
  at com.jayway.restassured.internal.RequestSpecificationImpl.post(RequestSpecificationImpl.groovy:248)
  at com.jayway.restassured.internal.RequestSpecificationImpl.post(RequestSpecificationImpl.groovy)
  at providers.Providers.nextApp(Providers.java:27)
  at providers.Providers.main(Providers.java:32)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
  08:59:30.359 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnection - Connection org.apache.http.impl.conn.DefaultClientConnection@1acaf3d closed
  08:59:30.359 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnection - Connection org.apache.http.impl.conn.DefaultClientConnection@1acaf3d shut down
  08:59:30.359 [main] DEBUG org.apache.http.impl.conn.BasicClientConnectionManager - Releasing connection org.apache.http.impl.conn.ManagedClientConnectionImpl@1bab8268
  </code></pre>