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.
Solution: Use requests to complete the lifecycle of a resource - Java Tutorial
From the course: Java: Automated API Testing with REST Assured
Solution: Use requests to complete the lifecycle of a resource
(upbeat music) - [Instructor] Great job. Let's walk through the solution of creating, updating, viewing, and deleting a product using API requests. To create a new product, we needed to make an API request to the create endpoint. We must give it the data of the product we'd like to create. So our body contains the name, the description, the price, and the category ID. Next, we make the request via the post method. And remember, this is the API method to create new resources. Now that our product is created, to update it, we use the update endpoint. We provide a body specifying the ID, which in my case, is 26. Yours could be different, just depends on what was stored in your database. And I also specify the price field with an updated value of six. I didn't include any other fields since they will remain the same. If you included all of the fields, that's okay. I just wanted to show you that those are not required.…
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
-
-