From the course: Java: Automated API Testing with REST Assured

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Making a POST request

Making a POST request - Java Tutorial

From the course: Java: Automated API Testing with REST Assured

Start my 1-month free trial

Making a POST request

- Post requests allow you to create a new resource within the system. So let's use the post method to create a brand new product. The create product endpoint will allow us to do that. So let's make a new test which declares this as an endpoint. We'll create a new test and we'll call this one create product. Inside of here. we can create an end point variable and assign it that value. Next we'll declare our response and we'll make a call to given. Okay. Here's where we need to specify any data that has to be sent along with our requests. We're calling this create endpoint. However, our request is not clear on what exactly we like created. Therefore we need to send along additional information. We'll need to specify the name of the product, a description, the price of the product and the ID of the category of this product should be created in. This is a lot of information. So passing it as query parameters is…

Contents