Note: This feature is currently in Beta and may contain bugs or issues. We appreciate your feedback and understanding as we work to improve its functionality.
Accessing the API Step
The API step can be added via the + button, just like other testing steps.
Once selected, the API step expands to full-screen view, where you’ll find the following fields:
Method: Options include GET, POST, PUT, DELETE, PATCH.
URL: The endpoint URL.
Tabs: The API step contains several tabs:
Headers
Parameters
Payload
Assertions
Response (once you make your first SEND action)
Tabs and Fields Overview
1. Headers Tab
This tab allows you to define dynamic name-value pair fields for headers. Click the ADD NAME-VALUE PAIR button to add more pairs.
2. Parameters Tab
Similar to the Headers tab, you can add name-value pair fields for parameters using the ADD NAME-VALUE PAIR button.
3. Payload Tab
The Payload tab includes the following fields:
Payload Type: A dropdown to select the payload type. Options include:
JSON
Text
JavaScript
HTML
Payload Content: A textarea field where you can enter the payload.
The preferred JSON type comes with a format checker.
An expected working example format is as follows:
{
"completed": false,
"title": "delectus aut autem",
"id": 1,
"userId": 1
}
4. Assertions Tab
The Assertions tab lets you validate the API response using different assertion types. The ADD ASSERTION button allows you to add assertions with the following options:
Body Text:
Assertion Types: Equals, Does not equal, Contains.
Value input field for expected text.
Status Code:
Assertion Types: Equals, Does not equal.
Input field for expected status code value.
Header:
Header Name input field.
Assertion Types: Equals, Does not equal, Contains.
Header Value input field.
Body JSON:
Key input field for the JSON key.
Assertion Types: Equals, Does not equal.
Value input field for the expected value.
Note: When the response body contains an array of objects, use the appropriate index notation (e.g., [0].id where 0 is the first index).
Sending the API Request
Once the API step is configured, click the SEND button. The backend performs a dry-run test, and the following tabs will appear:
Response Tab: Displays the response status and time.
Response Body Tab: Shows the full response body and instructions below for using GLOBALS with response body data.
Response Headers Tab: Shows the response headers and instructions below for using GLOBALS with response headers data.
Response Assertions Tab: Indicates which assertions passed (green text) and which failed (red text).
Using GLOBALS Variables Across Steps
The GLOBALS variable feature allows you to use response body data or response headers from one API step in subsequent steps. To enable this:
An instructional label, located below the Response Body Tab and Response Headers Tab, explains how to use the specific response body data or headers based on its API step id and type of response.
Example: To access object properties, use #{api-1gz3v8q-data.id}, or for nested array objects, use #{api-1gz3v8q-data[0].id}.And for response headers, for example, to save the name of the header, use #{api-1gz3v8q-headers[{index}].name}, or for the value of the header, use #{api-1gz3v8q-headers[{index}].value}
Using GLOBALS in Other Visual Steps
You can use the GLOBALS variable from an API step in other visual steps (e.g., "Check Step"):
After selecting the element locator in the Check Step, you’ll see an option to perform a Content Comparison.
Select Expect a specific text, and input the corresponding GLOBALS variable to compare against the element's content.
Using GLOBALS in Subsequent API Steps
You can also use the GLOBALS variable within other API steps for fields in:
Headers
Parameters
Assertions
Payload
Ensure that the correct structure is followed when referencing the GLOBALS variable, as described in the instructional label under the Response Body Tab & Response Headers Tab.
Using the API EXECUTION TIME LIMIT
The API EXECUTION TIME LIMIT is a feature that sets a maximum time in seconds before the API step times-out and sends a timeout error, if there is no response up to that selected time.
The time is set by moving the "deep sea green" colored rectangle to the left or right inside the grayish horizontal area, while you observe the desired value in seconds below it.