From the course: Java: Automated API Testing with REST Assured
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Making a PUT request - Java Tutorial
From the course: Java: Automated API Testing with REST Assured
Making a PUT request
- [Instructor] Put requests allow you to update an existing resource within the system. For example, we can use this endpoint to update a given product. Let's create a new test method, and we'll call this one update product. Inside of here, let's go ahead and specify the endpoint. And let's define the body. Now inside of this body, we'll need the ID of the product that we want to update, the name, the description, the price, and the category ID. So let's check the database so that we can gather the information we need to make this update. So I'm going to the console tab, and I'm going to say select everything from products where name equals water bottle. And when we execute this, you notice all of the details are here. So we're just going to copy that into our body. So we can start with the ID. And we see that the ID is 19. And let's go ahead and add the name. And that is water bottle. And by the way, these don't…
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
-
Request methods1m 47s
-
Making a GET request9m 48s
-
Making a POST request4m 16s
-
Making a PUT request3m 7s
-
Making a DELETE request1m 52s
-
Serializing request body7m 26s
-
Challenge: Use requests to complete the lifecycle of a resource42s
-
Solution: Use requests to complete the lifecycle of a resource2m 32s
-
-