Debugging APIs

Scenarios

You can debug an API on the management console by adding HTTP header parameters and body parameters.

  • APIs whose backend paths contain environment variables cannot be debugged.
  • When an API is bound to a signature key, the API cannot be debugged.
  • If a request throttling policy has been bound to an API, the policy does not take effect when you debug the API.

Prerequisites

  • An API has been created.
  • The backend service has been set up.

Procedure

  1. Log in to the DGC console, select a DGC instance, and click Access.

    On the displayed page, click the Workspaces tab. In the workspace list, locate the required workspace.

  1. Click Data Lake Mall of the corresponding workspace.

    The Data Lake Mall page is displayed.

  2. In the navigation pane on the left, click Exclusive Edition or Shared Edition. The required page is displayed.
  3. Choose APIs.
  4. Use either of the following methods to debug an API:
    • Locate the row that contains the target API, and choose More > Debug.
    • Click an API name to access the details page. Click Debug in the lower left corner.

      You can configure API request parameters in the left pane. See Table 1 for parameter details, The request information sent by the API and the returned result after the API request is invoked are displayed on the right.

      Table 1 Debugging APIs

      Parameter

      Description

      Query Parameter

      Query parameters and their values.

      Cluster Settings

      Supported only by the exclusive edition. Select the instance where the API to be debugged resides.

      The information displayed on the debugging page varies according to the request type.

  5. After adding the request parameters, click Send Request.

    The API calling response information is displayed in the command output area in the right pane.

    • If the API is successfully called, HTTP status code 200 and response information is returned.
    • If the debugging fails, the HTTP status code 4xx or 5xx is returned.
  6. You can send different requests using varied parameters and values to verify the API.

    To modify the API parameters, click Edit in the upper right corner. The API editing page is displayed.

Follow-up Procedure

After an API is debugged, you can publish the API. See Publishing APIs for details. Alternatively, you can create a request throttling policy for the API and bind it to the API for security purposes. See Creating Throttling Policies for details.