title: Rest Assured 400 Bad Request
body: <p>I writing an automation code in rest assured but it return 400 Bad Request and I don't know how to debug it. Hope someone can help. </p>
  
  <p>In postman, i must specify the username and password using raw approach. It will fail on form-data. <strong>How to specify raw data in rest-assured?</strong> </p>
  
  <p>Curl: </p>
  
  <pre><code>curl --location --request POST 'http://127.0.0.1:8010/api/v1/account/webapi/account/users/secure/webEncryptLogin?checkHash=false%0A' \
  --header 'device_token: wap' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "username": "peter1",
    "password": "SomeSecretPassword"
  }'
  </code></pre>
  
  <p>Rest Assured Java Code: </p>
  
  <pre><code>given().
                      contentType("application/json").
                      queryParam("checkHash", "false").
                      header("device_token", "wap").
                      params("username", "peter1", "password","SomeSecretPassword").
              when().
                      post("http://127.0.0.1:8010/api/v1/account/webapi/account/users/secure/webEncryptLogin").
              then().
                      log().ifError().
                      assertThat().
                      statusCode(200);
  </code></pre>
  
  <p>Questions: </p>
  
  <ol>
  <li>Anything wrong with the code?  </li>
  <li><strong>How to specify raw data with rest assured?</strong> </li>
  <li>How to extract access token into string?</li>
  </ol>
  
  <p>Please help. Thanks. </p>