How can i find the data type of request body in rest assured using java

31 views
Skip to first unread message

Bagavathi

unread,
Aug 31, 2023, 1:55:27 AM8/31/23
to REST assured
I'm trying to find the data type of the request body fields for the below-given code

import static io.restassured.RestAssured.given;
import java.io.File;
import org.testng.annotations.Test;
import io.restassured.RestAssured;
import io.restassured.module.jsv.JsonSchemaValidator;

public class DataType {
  @Test
   public void dataType(){

      given().header("Content-Type", "application/json").body("{\r\n"
      + "   \"name\": \"Apple MacBook Pro 16\",\r\n"
      + "   \"data\": {\r\n"
      + "      \"year\": \"2019\",\r\n"
      + "      \"price\": 1849.99,\r\n"
      + "      \"CPU model\": \"Intel Core i9\",\r\n"
      + "      \"Hard disk size\": \"1 TB\"\r\n"
      + "   }\r\n"
      + "}")
      .when().post("https://api.restful-api.dev/objects")
      .then().log().all();
  }
}

Prerana Sharma

unread,
Oct 3, 2023, 1:11:30 PM10/3/23
to REST assured
Anything with " " is a string 
Anything without "" is a integer. 
If it only 1/0 or true/false then that is boolean.

Reply all
Reply to author
Forward
0 new messages