Debug an API

Debugging an API allows faster identification and debugging of failed runtime requests.

Before you begin

Make sure that you have Manage APIs or Activate or Deacticate API's functional privileges.

About this task

The tracer in webMethods API Gateway has the debugging capability, which, when enabled, lists the API requests made. Tracer supports runtime request lifecycle monitoring in webMethods API Gateway. Inspecting the failed runtime requests helps you to debug and troubleshoot your API calls.

Note: You can trace REST, SOAP, and OData API calls.

The following example illustrates the steps to create a REST API Petstore Debugging, Enable tracing on this API, start the Petstore Debugging API by using Postman, and debug it.

Procedure

  1. Create a REST API by importing an API from a URL
    1. Open the menu options and select APIs.
    2. Click Create API.
    3. Click Import API from URL.
    4. Provide the following information

      The API is created and appears in the list of APIs.

  2. Click Activate to activate the API.
    The API details page displays the Basic information, Technical information, Resources, methods, and selected API specifications.
  3. Click Enable tracing.
    When you enable tracer, webMethods API Gateway captures a large amount of data, which might impact the performance and availability of webMethods API Gateway. Hence, disable the tracer when not needed.
  4. Now, you can start REST API URI in Postman. To know how to start API by using Postman follow the following steps.
    1. Open Postman and create a new request.
    2. Set the request method to GET and enter the URL http://host/port/gateway/Petstore%20Debugging/1.0.6/pet/1
    3. Click Send to start the endpoint.
      After the API is successfully called, a success message appears, and you are able to access the details in the Tracer tab.
  5. Click Tracer to view the trace details of Pet store Debugging.
  6. The Trace API page displays the Runtime events, Policies applied, and Event tracer details sections.
    Note: The Runtime events section lists only 20 runtime events per page. When you click the Select all per-page checkbox, all the runtime events of the API do not get selected. Instead, the 20 runtime events that are 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.

  7. In the Runtime events section, you can find Refresh, Filter, Import and View events, and Export options.
    • To filter the runtime events, click the calendar icon, 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.

    • In the Runtime events section, click the view icon 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.

    • In the Runtime events section, select the runtime event that you want to export or download. Click the export icon to export the runtime request.