Viewing API Response
Last updated
Last updated
Once the request is complete you can see the response in the Response panel of the tab. If you dont see the Response panel the the API request might have failed and you should see an error message like this.
If a response is returned by the server then you can see under the Body tab in the Response panel. You can also see the Status Code & Status Text for the response along with the Time taken for the request to complete at the top right corner of the Response panel. Under Body tab there are 3 different tabs to see your response.
Pretty - Formats and beautifies the response to make it more user readable.
Raw - Shows the response as it is received from the server
Preview - If the returned response has html content or is a image/audio/video the you can preview it under this tab
Test Builder: Provides an feature rich UI to build Tests based on your response
You can see the headers returned by the server under Headers tab.
You can add test cases to your API before running it under the Scripts tab before making a request. Once a response is received your test cases will be executed and results will be shown in the Test Cases tab in the Response panel. By default it will show all test results. To see only Passed or Failed results you can use the filter beside the results. Learn how to add Test Cases and perform end to end testing of your APIs.
Ex:
The same code above can also be written as:
Apic allows you to debug your test scripts by logging your variables. If you want to debug some values in your script the you can do that by adding logs. All your added logs will be shown in the Logs tab
Ex
APIC allows you to save your API response along with your API request.
To save your current API response, click on the Save response
button in Response panel.
To view the saved response for a request click on Load saved request
.
One the saved response is loaded you can start adding tests by clicking on the Build API Tests which open the Test Builder.