Why Debug an API?
No subtopics in thissection
Debugging an API allows faster identification and debugging of failed runtime requests.
The tracer in API Gateway has the debugging capability which, when enabled, lists the API requests made. Tracer supports runtime request life cycle monitoring in API Gateway. Inspecting the failed runtime requests helps you to debug and troubleshoot your API calls.
Before you begin
Ensure that you have:
Manage APIs or Activate / Deactivate API’s functional privileges.
In this example let’s see how to create a REST API Petstore Debugging, Enable tracing on this API, invoke the Petstor Debugging API using Postman, and debug it.
Create a REST API by importing an API from a URL
a. Click APIs in the title navigation bar.
b. Click Create API
c. Click Import API from URL.
d. Provide the following information:URL: https://petstore.swagger.io/v2/swagger.json
Name: Petstore Debugging
Version: 1.0.6
Description: Import REST API using URL
Type: Swagger
The API is created and appears in the list of APIs.
Click on the Activate button to activate API.
The API details page displays the Basic information, Technical information, Resources, methods, and selected API specifications.
Click on Enable tracing.
When you enable tracer, API Gateway captures a large amount of data, which might impact the performance and availability of the product. Hence Software AG strongly recommends you disable the tracer when not needed.
Now you can invoke REST API URI in Postman. To know how to invoke API using Postman follow the below steps:
a. Open Postman and create a new request.
b. Set the request method to GET and enter the URL: http://host/port/gateway/Petstore%20Debugging/1.0.6/pet/1
c. Click the Send button to invoke the endpoint.d. Once the API is successfully invoked, a success message will appear, allowing you to access the details in the Tracer tab.
Click the Tracer tab to view the trace details of Petstore Debugging.
The Trace API page displays the Runtime events, Policies applied, and Event tracer details sections.
NoteThe Runtime events section lists only 20 runtime events per page. When you click the Select all per page check box, all the runtime events of the API do not get selected. Instead, the 20 runtime events listed on that page get selected.The Runtime events section displays the list of runtime events. When you click Runtime event by default it refreshes the Policies applied and Event tracer details sections. Event tracer details display General Information, API request and response, and Server logs sections. In the Policies applied section, click the stage name for which you want to view the trace details.
In the Runtime events section, you can find Refresh, Filter, Import and View events, and Export options.
Filter : To filter the runtime events, click and select the time interval using Quick select and Commonly used filters. The Runtime events section displays the list of runtime events based on the applied filter.
Import and View events: In the Runtime events section, Click to import the archived runtime requests. The Import and view events pop-up window displays. Browse the runtime requests file that you want to import and View.
Export: In the Runtime events section, select the runtime event that you want to export or download. Click to export the runtime request.