From the course: Java: Automated API Testing with REST Assured
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Making a DELETE request - Java Tutorial
From the course: Java: Automated API Testing with REST Assured
Making a DELETE request
- [Instructor] Delete requests allow you to remove a resource from a system. We can delete a product by using this endpoint. Let's create a new test, and we'll call this one deleteProduct. Let's go ahead and define our endpoint. Let's also create a body. Inside of the body, we'll need to specify the ID of the product that we'd like to delete. So let's go to the database to determine what's the ID for the water bottle. So I'll say select from the products table where the name equals "Water Bottle". And we can see that the ID is 19. Perfect. So let's go ahead and add that ID to the body. We can specify ID, and then the value, which is 19. Great. Now we're ready to make our requests. So we're going to store that inside of the response. And we'll say, given this body, when we call the delete method on this endpoint, then we'll get a response. And we can print this response out by saying response.log.body. Great. Let's…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Anatomy of a request1m 47s
-
(Locked)
Request methods1m 47s
-
Making a GET request9m 48s
-
(Locked)
Making a POST request4m 16s
-
(Locked)
Making a PUT request3m 7s
-
(Locked)
Making a DELETE request1m 52s
-
(Locked)
Serializing request body7m 26s
-
(Locked)
Challenge: Use requests to complete the lifecycle of a resource42s
-
(Locked)
Solution: Use requests to complete the lifecycle of a resource2m 32s
-
-