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-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.
🌐
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
REST Assured is a Java DSL for simplifying testing of REST based services built on top of HTTP Builder. It supports POST, GET, PUT, DELETE, OPTIONS, PATCH and HEAD requests and can be used to validate and verify the response of these requests.
Author   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).
🌐
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.
🌐
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.
🌐
Techndeck
techndeck.com › post-request-using-rest-assured
How to send a POST Request using Rest Assured - Techndeck
April 21, 2022 - Let’s take an example of one of the API POST endpoint available at the above-mentioned website which is ‘/users’. The full-service URL with the endpoint is http://reqres.in/api/users · At the above resource URL, we are going to submit data in the form of JSON to create a user. ... Base URI is the root address of the Resource. And, by this particular line of code, we are specifying to REST assured to use “reqres.in/api” as the root URL of the service.
🌐
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.
🌐
Guru99
guru99.com › home › software testing › rest assured api testing tutorial
REST Assured Tutorial for API Automation Testing (Example)
1 week ago - It was a URL, and you are getting content from the API rather than posting or updating any existing content. That makes it a GET call. Remember this to understand our first test better. The goal of the script is to print the same output on your IDE console as what you received on the browser through 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%
🌐
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....
🌐
subodh's blog
subodhsingh.hashnode.dev › rest-assured-9-automating-post-request-user-registration-api
Rest Assured #9 - Automating POST Request (User Registration API)
February 11, 2023 - Send a POST request to the user registration API with the test data as the request body · Verify that the API returns a successful response with a 201 HTTP status code. Verify that the response contains a unique identifier for the new username. ... To start with Rest Assured for API testing we need first to import the Rest Assured package, we will need to add the RestAssured dependency to your project's pom.xml file in the Maven project.
🌐
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.