RestAssured is the java library which is used tp test REST APIs. It has very rich functionality. If you are working with maven project, you just need to add the dependency in pom.xml.
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured --><dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>5.1.1</version>
</dependency>
The library is automatically added in your project's maven dependency and then you can also add testng dependency.
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
<scope>test</scope>
</dependency>
I found a good set of example APIs which are in Json and xml both.
The URL is: https://restful-booker.herokuapp.com/apidoc/index.html