java rest api dependencies required code example

Example: maven dependencies for rest api

This include all basic component of RestAssured

<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>rest-assured</artifactId>
    <version>4.3.1</version>
    <scope>test</scope>

</dependency>

If we want to use serialization , de-serialization
we will need Jackson-Databind

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.11.2</version>
</dependency>

If we need Json schema validation

<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>json-schema-validator</artifactId>
    <version>4.3.1</version>
    <scope>test</scope>
</dependency>

JsonPath and XmlPath is already included in the
RestAssured dependency, If you want to work with
JsonPath and XmlPath outside context of RestAssured
, you may also add below 2 dependencies.
It will enable you to directly work with
json file or xml file and use JsonPath and XmlPath.

<dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>json-path</artifactId>
      <version>4.3.1</version>
      <scope>test</scope>
</dependency>

<dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>xml-path</artifactId>
      <version>4.3.1</version>
      <scope>test</scope>
</dependency>

Tags:

Java Example