Debugging API

Why Debug an API?

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.

Note
You can only trace REST, SOAP, and OData 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.

  1. 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.

  2. Click on the Activate button to activate API.

    The API details page displays the Basic information, Technical information, Resources, methods, and selected API specifications.

  3. 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.

  4. 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.

  5. Click the Tracer tab to view the trace details of Petstore 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 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.

  7. In the Runtime events section, you can find Refresh, Filter, Import and View events, and Export options. icon