Reviewing the API response and trace
Review the response to an API that was invoked in the API Connect Test tab. You can use the included trace information to debug the API's execution.
You can complete this task either by using the API Designer UI application, or by using the browser-based API Manager UI.
When the API request is invoked, the response displays in the “Response” section of the Test tab. The response always includes the HTTP status code the amount of time it took to receive a response. If the call completes (even if it returns an error), the response also includes headers and a body.
Click the Body tab to see the body of the response. When you review the body of the response, click the Parsed tab to view the response using the format that you specified in the "Accepts" request header. Click the Raw tab to view the unformatted response body.
Cache-Control: no-store
request header to prevent the browser from caching the
request. Depending on your server, you might want to use the Cache-Control:
no-cache
header instead.Click the Trace tab to display a record of the API execution so you can see what actions were triggered and the code that we executed for each action.
Examine the trace
Use the Trace tab to see exactly how the API call was executed. This is helpful when the call returned an error and you don’t know why. You can debug the API by reviewing the trace to see each step of the API's execution.
The Trace tab contains the following components to help you debug the API:
- Process flow diagram
- In the diagram, the policies (actions) that were executed during the call are highlighted while the rest of the process flow is dimmed. The highlights make it easy to see where the executed actions occurred in the overall flow while clarifying the actual flow of execution for the call. For example, if the process flow includes a switch with three options, only the option that was selected during the call is highlighted.
- Policies list
- A list of the highlighted policies lets you select a policy to examine its trace.
- Advanced toggle
- The Advanced toggle that lets you control the level of detail in the trace. A basic trace shows the code for the input and output of the selected policy. An advanced trace shows the full code for the policy’s execution.
- Code box
- The selected level of code for the current policy displays in the code box, where you can review it in detail to see exactly how that policy was executed. By default, a minimal version of the response displays (the endpoint, the request, and the response, and the status message), with sections collapsed. You can expand individual sections by clicking the expand icon next to each. To see the complete response, click the Advanced toggle.