Automation lab Aú API Interaction & Mocking (API_INTERACTION)

Lab 032: Validate API request body content

Practice validate api request body content in a real web app context as part of the API Interaction & Mocking module.

intermediate intermediate
intermediate

Objectives

Use for test scripts
  • Understand the purpose and business flow of validate api request body content.
  • Design stable locators for key UI elements.
  • Automate user interactions and verify the resulting UI state.

Sandbox

API & Network • api • intermediate • active

Validate API request body content

Build a request payload and ensure required fields are present.

Reading and understanding requirements Choosing stable locators Designing assertions based on business rules

Learning objectives

  • Serialize form inputs to JSON.
  • Validate presence of required keys.
  • Expose request preview for assertions.

Steps

  1. Fill fields (name, email, role).
  2. Submit to build request body.
  3. Assert required keys exist and are non-empty.
  4. Check status text reflects validation.

Practice sandbox

Compose an API request body.

Request body

{}

Waiting for input

Assertions to practice

  • Required: name, email, role.
  • Status shows success when all present.
  • Preview JSON matches inputs.