Skip to main content
🚀 See how 20+ AI Agents can make your QA faster and smarter. Join 10k+ QAs at global leadership summit! Register Now
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Add validations or extract values from API responses

Learn how to validate API calls for accurate and reliable tests.

Low Code Automation allows you to make API calls while recording your test, solving the complexity of automating test cases that involve dependencies beyond the web application UI. You can integrate API calls directly into tests for:

  • Initializing test environments
  • Invoking specific services
  • Checking backend conditions
  • Managing test data

Add API step

To add API requests in your tests, click the ︙ icon in the recorder panel and select Add API to configure an API step.

Add API requests to your tests

You will see a response window to fill in the request details like API URL, Parameters, Authorization, Header, and Body.

Request data

Low Code Automation supports both JSON and XML response types for API steps.

Add request parameters

Attributes Description
Method Select the HTTP method for the API call, including options like GET, POST, PUT, DELETE, or PATCH.
URL Specify the URL for the API endpoint.
Parameters Specify key-value fields for query parameters.
Authorization Select and apply the suitable authorization method (Basic, Bearer) for the API call.
Header Configure headers such as cookies, content-type, encoding, and language according to your API specifications.
Body Specify the data to send in one of the following formats:
- Form data or key-value fields
- Raw
Response Type Select the expected response format for the API call:
- JSON
- XML

Import existing variable

Import an existing variable or link it to a test dataset variable. Click the + icon and select Local variables or Test dataset variables. You can import a variable or test dataset variable into any API field, such as URL, Username, Key, Value, and more.

Import local and test data variable

Validate or extract response details

After you fill in the request fields and click send, the request is executed and a response is populated. The response contains:

  • Status
  • Response headers
  • Response body (JSON or XML)

View response value

You can then validate and extract values from both JSON and XML responses.

You can add either validations or extract values in a single API step. To perform both actions, add another API step and configure the additional validation or extraction as needed.

Validate JSON response

  1. Expand the response section to add validations on status, headers, or body.
  2. Hover over any value, and you will see the Validate option appear.
  3. Click Validate to add validation on the respective field.
  4. You can add multiple validations in a single API step.

Extract value from JSON response

Click the Extract value option to store any response status, header, or body value from a JSON response into a variable. You can use this variable in later steps of your test. For example:

{
  "user": {
    "id": 12345,
    "name": "Jane Doe"
  }
}

If you want to extract the user ID, set the JSON path to $.user.id. The extracted value (for example, 12345) is stored in a variable, which you can reference in subsequent test steps.

You can either extract value or validate value. Switching from validation to extraction will remove existing validations.

Validate XML response

  1. Expand the response section to add validations on status, headers, or body.
  2. Hover over any XML node or attribute, and you will see the Validate option appear.
  3. Click Validate to add validation using XPath expressions for the selected XML element.
  4. You can add multiple validations in a single API step.

Extract value from XML response

Click the Extract value option to store any XML node or attribute value into a variable. Use XPath to select the value you want to extract. This variable can then be imported in any future steps. For example:

<user>
  <id>12345</id>
  <name>Jane Doe</name>
</user>

If you want to extract the user ID, set the XPath to /user/id. The extracted value (e.g., 12345) is stored in a variable, which you can reference in later test steps.

API step execution

After test execution, a new See Details button appears, showing details about the API execution call.

Click this button to view the request, the generated response (JSON or XML), along with the extracted variable values or validation results. If multiple validations were added, you will see results for all the passed and failed validations. For XML, the validation results display the XPath used and the value checked.

View the validation results

View the extracted variable

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle