REST API steps in plain Gherkin. Base URL, headers, body, JSON Pointer, status codes, JSON Schema. Lets QA and automation teams cover backend contracts in the same suite as UI flows.
Step phrasings in this group
The book sidebar lists each individual step page under this group.
Given I am authenticating as "admin" with "password123" passwordHelper function to replace placeholders in text
Given I set header "Content-Type" with value "application/json"Sets a single HTTP request header.
Given the API base URL is "https://jsonplaceholder.typicode.com"Set the base URL for API calls. Accepts full URLs or paths relative to LAUNCH_URL.
Given I set the header "Content-Type" to "application/json"Set a request header. Alternative syntax.
Given I set the following headers:Set multiple headers using a table.
Given I set the request body to '{"name": "John", "email": "john@example.com"}'Set request body data for POST/PUT requests.
Given I set the request body with:Set request body using a table.
When I send a GET request to "/users"Sends HTTP request to specific relative URL.
When I send a POST request to "/users" with values:Sends HTTP request to specific URL with field values from Table.
When I send a POST request to "/users" with body:Sends HTTP request to specific URL with raw body from PyString.
When I send a POST request to "/login" with form data:Sends HTTP request to specific URL with form data.
Then the API response code should be 200Checks that API response has specific status code.
Then the API response should contain "success"Checks that API response body contains specific text.
Then the API response should not contain "error"Checks that API response body doesn't contain specific text.
Then the API response should contain json:Checks that API response body contains JSON from PyString.
Then the JSON response should have "name" equal to "John Doe"Alternative syntax for JSON property verification.
Then the JSON response should have property "id"Verify a JSON property exists.
Then the JSON response should not have property "password"Verify a JSON property does not exist.
Then the response should be valid JSONVerify the response is valid JSON.
Then the response header "Content-Type" should be "application/json"Verify response header value.
Then print API responsePrints the most recent API response body to stdout for debugging.
Given I set placeholder "{{userId}}" to "123"Sets placeholder for replacement in URLs, requests, and responses.