Automating API Using API collectionValidating API Response Code

Validating API Response Code

This article helps in validating API response code.

Validating API Response

You can validate an API Response code in the Output tab.

Perform the following to access Output tab.

Navigate to the collections after selecting a API project.

In the API screen, enter the URL and click on output button.

You can add API response Key and Value and click on send.

API request screen with GET URL field, Send button and Output tab showing response

You'll get the response code and you validate seeing that.

Test data editor showing testing_apiendpoint, testing_apioutput and testing_storeresponsevariable1 lines

You can also validate API response code using schema verification.

Response schema verification is added to ensure that the API responses adhere to the expected structure and data types.

In output you can add schema as per your requirement.

API request Output tab showing verify_schema JSON with properties ok, accessToken and refresh_token

After execution, you can see that the schema is available for verification in the report.

API response JSON on green background showing user subscription fields and verify_schema block