Skip to main content

Overview

Send REST or GraphQL requests inside a test and optionally store the response for later steps (status, headers, body). API Request overview

At a glance

  • Request types: REST or GraphQL (GraphQL uses POST and JSON automatically)
  • Methods: GET, POST, PUT, DELETE, PATCH
  • Inputs: URL, Params, Headers, Body (Raw JSON or Form Data)
  • GraphQL: Query, Variables, optional Operation name
  • Store result: Save to a response variable for later use
  • Expressions: Use environment and expression variables in any field
REST form GraphQL editors

Common actions

  • GET with params
    • Choose REST → Method: GET
    • Enter URL → add Params (key/value)
    • Optional Headers (e.g., Authorization)
    • Set Response variable if you’ll reuse the data
  • POST JSON
    • REST → Method: POST
    • Headers: Content-Type application/json (+ auth if needed)
    • Body: Raw → JSON → paste payload
    • Set Response variable
  • PUT with form data
    • REST → Method: PUT
    • Body: Form Data → add fields
    • Add auth header if required
  • GraphQL query
    • Select GraphQL → URL = endpoint
    • Paste Query and Variables (JSON)
    • Optional Operation name → set Response variable
  • GraphQL mutation
    • Same as query → paste mutation and input variables

Helpful options

  • URL preview includes Params automatically
  • Content-Type header set based on Body/GraphQL
  • Beautify for JSON and GraphQL
  • Light/dark editor themes

Troubleshooting

  • 401 Unauthorized: Check Authorization header/token and environment variables
  • 400 Bad Request: Validate JSON syntax and required fields
  • Invalid URL: Include protocol (https://) and correct path
  • GraphQL errors: Inspect errors alongside data
  • Missing response variable: Ensure a valid name is set and the step passes

Best practices

  • Use environment variables for base URLs and tokens
  • Request only the fields you need (GraphQL)
  • Prefer variables over string interpolation in GraphQL
  • Validate expected status codes in a follow-up step
  • Never hardcode secrets in tests
I