Skip to content

Validate API Response Content: RESPONSE_VALIDATE_CONTENT

The Validate API Response Content command is used to validate whether a specific JSON value from a API response matches an expected value. This ensures that the API returns the expected content.

Example: Suppose you are testing an API that processes loan applications. After submitting a request, the API returns a response with a status field, and you need to verify that the status is “approved“.

Steps to Configure:

  1. Select Validate API Response Content from the Action dropdown.
  2. Leave the Screen Name field blank.
  3. In the Element Key field, enter the expected JSON value as a string (e.g., { “status”: “approved” }).
  4. In the Parameters section, enter the variable name that will store the validation result (e.g., ValidationResult).
  5. Click Save.

When executed, this command compares the expected JSON value with the actual API response.

Note: While the steps for adding an action command are identical in both views, the display of the steps changes:

scrn-validate-api-response-content-tabular-view
Tabular View
scrn-validate-api-response-content-card-view
Card View

Example Workflow:

The following screenshot illustrates how the Validate API Response Content command is structured within an API test case in HuLoop.

scrn-example-workflow-validate-api-response-content
Workflow showing the Validate API Response Content step in an API automation sequence

Expected Outcome on Execution:

  • If the API response has { “status”: “approved” }, the ValidationResult variable stores true.
  • If the response does not match, ValidationResult stores the differences between the expected and actual values for further analysis.

Notes:

  • Ensure that the expected JSON value in the Element Key exactly matches the format of the API response, including proper syntax and structure.
  • The API response should be from a previously completed call within the automation flow.

Back To Top