Put Request | Bondar Academy
Course: Playwright API Testing with TypeScript
Module: API Testing Basics
Instructor: Artem Bondar
Lesson Summary
In this lesson, we learned how to perform a PUT request in Playwright, which is essential for updating existing records. Here's a summary of the key points covered: Understanding PUT Requests PUT request : Used to update an existing record. POST request : Used to create a new record. Performing a PUT Request To illustrate the PUT request, we used a test application to: Create a new article with a title and description. Update the article by modifying its title. During the update, we inspected the Networking tab to observe the PUT request, which included: The URL containing the slug ID of the article. A request payload with the updated article details. A response status of 200 indicating success. Using Postman for Testing We recreated the PUT request in Postman by: Copying the URL and setting it as a PUT request. Including the authorization header and the request body. Validating the response and checking the article's status. Implementing in Playwright In the Playwright code, we structured our test to: Get the authorization token. Create a new article and extract its slug ID . Perform the PUT request to update the article. Validate the update by checking the article's title. Delete the article using the updated slug ID . In summary, the PUT request is similar to the POST request, with the main difference being that it updates an existing record using its unique identifier in the request URL.