Overview

The API Request step allows you to send HTTP requests to REST APIs as part of your test workflow. This powerful feature enables API testing, data setup, external integrations, and validation of backend services within your end-to-end test cases.

Form Fields

Field NameTypeRequiredDescription
HTTP MethodselectYesHTTP method (GET, POST, PUT, DELETE, PATCH)
URLinputYesComplete API endpoint URL
Query ParameterseditorNoURL query parameters in key-value pairs
HeaderseditorNoHTTP headers in key-value pairs
Body TypetoggleNoRequest body format (Raw, Form Data, None)
Body ContenteditorNoRequest payload content
Response VariableinputNoVariable name to store the API response

Form Configuration

Request Configuration

HTTP Method Selection

  • GET: Retrieve data from the API
  • POST: Create new resources or submit data
  • PUT: Update existing resources completely
  • DELETE: Remove resources from the API
  • PATCH: Partially update existing resources
Color-coded method indicators:
  • GET: Green
  • POST: Yellow
  • PUT: Blue
  • DELETE: Red
  • PATCH: Purple

URL Field

  • Complete URL: Enter the full API endpoint URL including protocol
  • Real-time Validation: URL format validation with error feedback
  • Environment Variables: Support for environment variable substitution
  • Query Parameter Integration: Automatically appends parameters from the Params tab

Tabbed Configuration Interface

Params Tab

Query parameters configuration:
  • Key-Value Editor: Add multiple query parameters
  • Dynamic Rows: Automatically add new rows as needed
  • URL Preview: Parameters are automatically appended to the URL
  • Empty Row Handling: Clean removal of empty parameter rows

Headers Tab

HTTP headers configuration:
  • Standard Headers: Common headers with autocomplete suggestions
  • Custom Headers: Add any custom headers required by your API
  • Content-Type: Automatically set based on body type selection
  • Authorization: Add Bearer tokens, API keys, or other auth headers

Body Tab

Request payload configuration: Body Type Selection:
  • None: No request body (typical for GET requests)
  • Raw: Text-based content with format options
  • Form Data: Key-value pairs for multipart/form-data
Raw Content Types:
  • JSON: JSON payload with syntax highlighting and formatting
  • Text: Plain text content
  • XML: XML data with syntax highlighting
  • HTML: HTML content for specialized use cases
Editor Features:
  • Monaco Editor: Full-featured code editor with syntax highlighting
  • Theme Support: Automatic light/dark theme adaptation
  • JSON Beautify: Format JSON content with proper indentation
  • Error Detection: Syntax error highlighting for JSON content

Advanced Settings

Response Variable

  • Optional Field: Only needed if you want to store the response
  • Variable Naming: Alphanumeric names for storing API response data
  • Scope: Response variables are available in subsequent test steps
  • Data Access: Access response body, status code, and headers

Examples

GET Request with Query Parameters

Retrieve user information:
  • Method: GET
  • URL: https://api.example.com/users
  • Params:
    • id: 12345
    • include: profile,settings
  • Headers:
    • Authorization: Bearer {{API_TOKEN}}
  • Response Variable: userResponse

POST Request with JSON Body

Create a new user account:
  • Method: POST
  • URL: https://api.example.com/users
  • Headers:
    • Content-Type: application/json
    • Authorization: Bearer {{API_TOKEN}}
  • Body Type: Raw (JSON)
  • Body Content:
{
  "name": "John Doe",
  "email": "john.doe@example.com",
  "role": "user",
  "preferences": {
    "notifications": true,
    "theme": "dark"
  }
}
  • Response Variable: createUserResponse

PUT Request with Form Data

Update user profile with file upload:
  • Method: PUT
  • URL: https://api.example.com/users/12345
  • Headers:
    • Authorization: Bearer {{API_TOKEN}}
  • Body Type: Form Data
  • Form Data:
    • name: Jane Smith
    • bio: Software Developer
    • avatar: @/path/to/image.jpg
  • Response Variable: updateResponse

DELETE Request

Remove a user account:
  • Method: DELETE
  • URL: https://api.example.com/users/12345
  • Headers:
    • Authorization: Bearer {{API_TOKEN}}
  • Response Variable: deleteResponse

API Authentication Setup

Obtain authentication token:
  • Method: POST
  • URL: https://api.example.com/auth/login
  • Headers:
    • Content-Type: application/json
  • Body Type: Raw (JSON)
  • Body Content:
{
  "username": "{{USERNAME}}",
  "password": "{{PASSWORD}}"
}
  • Response Variable: authResponse

Best Practices

URL Construction

  • Complete URLs: Always use full URLs including protocol (https://)
  • Environment Variables: Use environment variables for base URLs and API endpoints
  • Parameter Encoding: Let the system handle proper URL encoding of parameters
  • Path Variables: Include dynamic path segments directly in the URL

Authentication Management

  • Environment Variables: Store API keys and tokens in environment variables
  • Header Consistency: Use consistent header names across API requests
  • Token Refresh: Plan for token expiration and refresh workflows
  • Security: Never hardcode sensitive credentials in test cases

Request Configuration

  • Appropriate Methods: Use correct HTTP methods for each operation
  • Content Types: Set proper Content-Type headers for request bodies
  • Error Handling: Plan for various response status codes
  • Timeouts: Consider API response times for test reliability

Response Handling

  • Variable Storage: Store responses when you need to use the data later
  • Status Validation: Verify expected status codes in subsequent steps
  • Data Extraction: Extract specific values from responses for use in other steps
  • Error Responses: Handle both success and error response scenarios

Technical Implementation

Request Processing

The API Request step handles:
  • URL Construction: Combines base URL with query parameters
  • Header Management: Merges default and custom headers
  • Body Serialization: Converts form data and raw content appropriately
  • Authentication: Handles various authentication methods
  • Error Handling: Manages network errors and invalid responses

Response Processing

Response handling includes:
  • Status Code Capture: Records HTTP status codes
  • Header Extraction: Captures response headers
  • Body Parsing: Handles JSON, XML, and text responses
  • Variable Storage: Stores response data for later use
  • Error Information: Captures error details for debugging

Environment Integration

  • Variable Substitution: Replaces environment variables in URLs and headers
  • Dynamic Configuration: Adapts to different testing environments
  • Credential Management: Securely handles API credentials
  • Base URL Management: Supports different API base URLs per environment

Advanced Features

Response Data Access

Access different parts of the API response:
  • Response Body: responseVariable.body - The main response content
  • Status Code: responseVariable.status - HTTP status code (200, 404, etc.)
  • Headers: responseVariable.headers - Response headers object
  • Error Information: responseVariable.error - Error details if request failed

Content Type Handling

Automatic handling of different content types:
  • JSON: Automatic parsing and formatting with syntax highlighting
  • XML: Proper formatting and syntax highlighting
  • Text: Plain text handling with line wrapping
  • HTML: HTML content with appropriate formatting

Form Data Support

Comprehensive form data handling:
  • Key-Value Pairs: Simple form field submission
  • File Uploads: Support for file upload fields (planned feature)
  • Multi-part Encoding: Proper multipart/form-data encoding
  • Field Validation: Validation of form field names and values

Integration with Other Steps

Variable Flow

  • Input Variables: Use variables from Extract Value or JavaScript steps in API requests
  • Output Variables: API responses can be stored and used in subsequent steps
  • Data Transformation: Process API responses with JavaScript steps
  • Conditional Logic: Use API responses in conditional steps

Test Flow Integration

  • Setup Phase: Use API requests for test data preparation
  • Validation Phase: Verify UI changes against API responses
  • Cleanup Phase: Use API requests to clean up test data
  • Authentication: Manage authentication tokens across test steps

Error Handling

  • Response Validation: Verify expected status codes and response content
  • Retry Logic: Implement retry logic for transient failures
  • Fallback Scenarios: Handle API unavailability gracefully
  • Error Reporting: Capture API errors for test debugging

Common Issues

URL and Endpoint Issues

  • Problem: Invalid URL format causes request failures
  • Solution: Ensure URLs include protocol and are properly formatted
  • Validation: Use the built-in URL validation to catch format errors

Authentication Problems

  • Problem: API requests fail with 401 Unauthorized errors
  • Solution: Verify API keys, tokens, and authentication headers are correct
  • Debugging: Check that environment variables contain valid credentials

Request Body Issues

  • Problem: API returns 400 Bad Request for malformed request bodies
  • Solution: Validate JSON syntax and ensure required fields are included
  • Tools: Use the JSON beautify feature to format and validate JSON content

Response Variable Issues

  • Problem: Response data not available in subsequent steps
  • Solution: Ensure response variable name is set and alphanumeric
  • Verification: Check that the API request completed successfully before using response data

Network and Timeout Issues

  • Problem: API requests timeout or fail due to network issues
  • Solution: Verify API endpoint availability and consider increasing timeouts
  • Environment: Ensure test environment can reach the API endpoints
  • Run JavaScript - For processing API responses with custom logic
  • Extract Value - For extracting specific values from API response variables
  • Fill - For using API response data in form fields
  • Verify Value - For validating API response data against UI content
  • Conditional Step - For creating conditional logic based on API responses