Looks like your server is expecting a request body but you're sending the data as query parameters. If I understand it correctly you want to send your data as JSON. The easiest way to do this is using this approach:

Map<String, Object>  map = new HashMap<>();
map.put("name", "Test12");
map.put("title", "Test127123");
map.put("contactEmail", "[email protected]");
map.put("description", "testing purpose");
    
ResponseBody body = 
    given().
        accept(ContentType.JSON).
        contentType(ContentType.JSON).
        header("userid", "131987").
        body(map).
    when().
        post("").
    thenReturn().body();
Answer from Johan on Stack Overflow
๐ŸŒ
TOOLSQA
toolsqa.com โ€บ rest-assured โ€บ post-request-using-rest-assured
Understanding POST request method using Rest Assured
February 7, 2022 - Post request mostly results in creating a new record in the database. It can also update the existing record in the database. Rest Assured uses a post () method to make HTTP POST requests.
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ http client-side โ€บ a guide to rest-assured
A Guide to REST-assured | Baeldung
January 11, 2025 - Explore the basics of REST-assured - a library that simplifies the testing and validation of REST APIs.
๐ŸŒ
Rest-assured
rest-assured.io
REST Assured
2026-01-16: REST Assured 5.5.7 is released with backported support for Spring framework 7 MockMvc support.
๐ŸŒ
DevQA
devqa.io โ€บ rest-assured-api-requests-examples
REST-assured Examples: GET, POST, PUT, PATCH, DELETE
October 26, 2020 - To send a POST request in REST-assured, we use the post() method:
๐ŸŒ
GitHub
github.com โ€บ rest-assured โ€บ rest-assured โ€บ wiki โ€บ usage
Usage ยท rest-assured/rest-assured Wiki ยท GitHub
In case of GET query parameters will automatically be used and in case of POST form parameters will be used. In some cases it's however important to separate between form and query parameters in a PUT or POST.
Author ย  rest-assured
๐ŸŒ
TOOLSQA
toolsqa.com โ€บ rest-assured โ€บ rest-assured-examples
Understanding Rest Assured Examples - GET, POST, PUT, DELETE
April 8, 2022 - Here we post a request to BookStore and get the response from the API. The HTTP PUT request either update a resource or substitutes the representation of the target resource with the full JSON request payload. For a detailed discussion on HTTP PUT requests, visit PUT Request using Rest Assured.
๐ŸŒ
Naveenautomationlabs
naveenautomationlabs.com โ€บ http-post-method-using-restassured
HTTP POST Method Using RestAssured
package com.restassured.tests; import org.json.JSONArray; import org.json.JSONObject; import org.junit.Test; import io.restassured.http.ContentType; import static io.restassured.RestAssured.given; /** * * @author Mandeep kaur * */ public class SamplePostRestTest { @Test public void createUser_whenSuccess() { JSONArray jsonArray = new JSONArray(); jsonArray.put("Employee"); JSONObject jo = new JSONObject(); jo.put("name", "john"); jo.put("age", "22"); jo.put("city", "chicago"); jsonArray.put(jo); given().log().all().header("authorization", "Bearer 0431655cfe7ba40a791e0ce32d83ad33363348919c11627f409a3228f205e15f23") .accept(ContentType.JSON) .contentType("application/json") .and() .body(jsonArray.toString()) .post("https://gorest.co.in/public-api/users") //hit the post end point .thenReturn().asString(); } }
Find elsewhere
๐ŸŒ
How to do in Java
howtodoinjava.com โ€บ home โ€บ java libraries โ€บ rest-assured http post and put examples
REST-assured HTTP POST and PUT Examples
August 22, 2022 - User user = new User("lokesh", "admin@howtodoinjava.com"); given() .body(user) .contentType("application/json") .when() .post("/users") .then() .statusCode(equalTo(201)); The User is a simple POJO without any annotation. public class User { private String name; private String email; //Setters, getters and constructors } To customize the serialization and deserialization, REST-assured support object mappers from GSON, JAXB, Jackson, Faster Jackson and Eclipse Yasson (JSON-B).
๐ŸŒ
DevQA
devqa.io โ€บ rest-assured-post-request
How to Submit Form Data With REST-assured Post Request
import io.restassured.RestAssured; import io.restassured.http.ContentType; import org.junit.Test; import static io.restassured.RestAssured.given; public class restAssuredPostRequest { @Test public void submitForm() { RestAssured.baseURI = "https://www.example.com"; given().urlEncodingEnabled(true) .param("username", "user@site.com") .param("password", "Pas54321") .header("Accept", ContentType.JSON.getAcceptHeader()) .post("/login") .then().statusCode(200); } } ... Other than submitting Form data, you can also use REST-assured POST request to send JSON payload to some resource.
๐ŸŒ
DZone
dzone.com โ€บ testing, deployment, and maintenance โ€บ testing, tools, and frameworks โ€บ how to test post requests with rest assured java for api testing: part ii
Test POST Requests With Rest-Assured Java for API Testing II
December 12, 2025 - The REST Assured framework provides flexibility to post the request body in the POST API requests. The request body can be posted using a String, JSON Object, or JSON Array, Java Collections such as List and Map, JSON files, and POJOs.
๐ŸŒ
DZone
dzone.com โ€บ testing, deployment, and maintenance โ€บ testing, tools, and frameworks โ€บ how to test post requests with rest assured java for api testing: part i
Test POST Requests With REST Assured Java for API Testing
November 25, 2025 - With the addition of dependencies ... API automation testing using REST Assured. A POST request is used to create a new resource on the server by sending data in the request body....
๐ŸŒ
Medium
medium.com โ€บ chaya-thilakumara โ€บ rest-assured-api-testing-part-1-e96a2f284a6e
REST Assured API testing. -With sample requests and tests forโ€ฆ | by Chaya Thilakumara | Chaya Thilakumara | Medium
May 19, 2020 - Rest assured is java library for testing Restful Web services. It can be used to test XML & JSON based web services. It supports GET, POST, PUT, PATCH, DELETE, OPTIONS and HEAD requests and can be used to validate and verify the response of ...
๐ŸŒ
Techndeck
techndeck.com โ€บ post-request-using-rest-assured
How to send a POST Request using Rest Assured - Techndeck
April 21, 2022 - post request rest assured. post request rest assured. post request rest assured.
๐ŸŒ
Elias Nogueira
eliasnogueira.com โ€บ the-best-way-to-add-a-request-body-to-a-post-request-using-rest-assured
The best way to add a Request Body to a POST request using Rest-Assured
Rest-Assured will use one of the object mapping libraries you added to your classpath to bind the attributes from a Java object into the request body. We already know that we required, for this example, the name and job attributes to post a user.
๐ŸŒ
Apps Developer Blog
appsdeveloperblog.com โ€บ home โ€บ java โ€บ restful web services โ€บ rest assured โ€บ rest assured http post request
REST Assured HTTP Post Request - Apps Developer Blog
October 27, 2022 - And finally, we can send an HTTP Post request to a RESTful Web Service endpoint. ... Below is a complete Test class source which demonstrates how to use REST Assured to test a RESTful Web Service endpoint by sending it an HTTP POST request containing JSON payload with user login credentials and then validating the Response object Headers to make sure that the required headers are present.
๐ŸŒ
Medium
medium.com โ€บ @bubu.tripathy โ€บ testing-restful-apis-with-rest-assured-6d245401deea
Testing RESTful APIs with REST-Assured | by Bubu Tripathy | Medium
May 9, 2023 - Then, we send a POST request to the specified URL ("/users") using the post() method. Finally, we validate that the response has a status code of 201 (Created) and the "id" field is not null.
๐ŸŒ
QA Automation Expert
qaautomation.expert โ€บ 2023 โ€บ 10 โ€บ 13 โ€บ how-to-test-post-request-using-rest-assured
How to test POST Request using Rest Assured โ€“ QA Automation Expert
April 4, 2025 - Last Updated On HOME In the last tutorial, I explained How to test GET Request using Rest Assured. In this tutorial, I will automate a POST Request using Rest Assured. I will verify the status code, line of Status, and content of the Response. To set up a basic Rest Assured Maven Project, click ...
๐ŸŒ
Medium
medium.com โ€บ javarevisited โ€บ how-to-test-post-requests-with-rest-assured-java-for-api-testing-part-ii-30dfe04a533a
How to Test POST Requests with Rest-Assured Java for API Testing: Part II | Javarevisited
December 10, 2025 - Learn how to use JSON Files, the Builder design pattern with the Datafaker library in Java, to test a POST API Request with Rest-Assured
๐ŸŒ
GitHub
github.com โ€บ rest-assured โ€บ rest-assured
GitHub - rest-assured/rest-assured: Java DSL for easy testing of REST services ยท GitHub
2025-08-15: REST Assured 5.5.6 is released with bug fixes and minor improvements. See change log for more details. ... given(). param("key1", "value1"). param("key2", "value2"). when(). post("/somewhere").
Starred by 7.1K users
Forked by 1.9K users
Languages ย  Java 85.6% | Groovy 12.9%