Rayrun
← Back to videos

Playwright Tutorial | Put Call For API Testing with Playwright

Pass Request body / Request Payload for Put API call

Welcome to another informative video on V Infinite's channel! This session is part of the Playwright with TypeScript series and focuses on making PUT calls for API testing.

The video begins with an introduction to PUT calls, explaining that they are a type of HTTP request used to update an existing resource or create a new one if it doesn't already exist. Unlike PATCH requests, which are used for partial updates, PUT requests replace the entire resource at the specified location. When making a PUT call, data is sent in the request body, usually formatted as JSON or XML.

The video outlines the necessary components for performing a PUT call: the base URL, resource, header (if required), and the request body or payload. For viewers who haven't watched the previous videos on GET and POST calls, the host provides links to those videos and recommends watching them for a better understanding.

For the practical demonstration, the host uses the Restful Booker site (restful-booker.herokuapp.com) to show how to make a PUT call to update a booking. The demonstration includes:

  • Showing the base URL and resource path.
  • Explaining the structure of the cURL command used for PUT calls.
  • Passing necessary headers, including authorization.
  • Using Postman to perform the PUT call.
  • Fetching and updating booking details using Postman.

After showing how to perform PUT calls with Postman, the video transitions to using Playwright for the same task. The host explains the code to make a PUT call using Playwright in a TypeScript environment. This includes setting up the test script, defining the request fixture, and performing the call.

The video also covers validating the response using assertions to check the status code, status text, and response body. The host provides examples of how to perform these validations and explains how to retrieve and update data via HTTP methods.

Finally, the host demonstrates how to run the script and validate the response, ensuring that the data has been updated as expected. A quick recap of the video highlights all the key points covered in the session.

For more detailed instructions and code snippets, viewers are encouraged to refer to the video and the accompanying description. Don't forget to like, share, and subscribe to the channel for more tutorials!

Related Videos

#16 - ARIA and how Playwright is making use of it to identify UI controls?
#16 - ARIA and how Playwright is making use of it to identify UI controls?
Create feature, steps & config | Playwright & Cucumber - Typescript | Part 1
Create feature, steps & config | Playwright & Cucumber - Typescript | Part 1
Getting Started with Playwright and VS Code
Getting Started with Playwright and VS Code
Playwright Base URL | Playwright Tutorial - Part 39
Playwright Base URL | Playwright Tutorial - Part 39
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].