Updated on 2024-08-16 GMT+08:00

Debugging an API

After creating an API, debug it on the APIG console by setting HTTP headers and body to verify whether the API is running normally.

  • APIs with backend request paths containing variables cannot be debugged.
  • If a plug-in or traditional policy is bound to an API, the policy does not take effect during API debugging.
  • The maximum backend timeout is 60s for API debugging.

Prerequisites

You have set up the backend service of the API.

Procedure

  1. Go to the APIG console.
  2. Select a dedicated gateway at the top of the navigation pane.
  1. Choose API Management > API Groups.
  2. Click a group name.
  3. On the APIs tab, select the target API and click Debug.
  4. Configure the URL and request parameters of the API.

    Select a request method, protocol, and domain name, and set request parameters.

    Select the debugging or an independent domain name. If you select a wildcard domain name, specify the subdomain name.

    If the independent domain name you select is a wildcard domain name, you can use any of its subdomain names to access all APIs in the group to which the domain name is bound.

    For example, if a wildcard domain name is *.aaa.com, the subdomain name can be default.aaa.com or 1.aaa.com.

  5. Click Debug.
  6. The box on the lower right displays the response of the API request.

    • If the debugging is successful, an HTTP status code starting with 2 and response details are displayed.
    • If the request fails to be sent, an HTTP status code 4xx or 5xx is displayed. For details, see Error Codes.

  7. You can send more requests with different parameters and values to verify the API.

Follow-Up Operations

After the API is successfully debugged, publish the API in a specific environment so that the API can be called by users. To ensure security, create policies for the API.