I am trying to hit API using Rest assured which is a POST request with form param client id, user and password. and multiple header .
I am getting 415, unsupportted media type error. My code is:
Response res =
given().
.header("Accept", "application/json")
.header("Content-Type", "application/x-www-form-urlencoded")
.header("channel","")
.formParam("grant_type", "password")
.formParam("client_id", "")
.formParam("secret", "")
.formParam("userId", "")
.formParam("password","").
when()
.post("/apiname");
System.out.println(res.body().asString());
Return type is json.
Same thing is working on PostMan. Please help in this.