API Inspector is an experimental feature. With API Inspector, you can view the API calls behind each operation in the console, and automatically generate API code of different languages. You can debug online through Cloud Shell or OpenAPI Explorer.

Features

API Inspector, OpenAPI Explorer, and Cloud Shell form an integrated solution for you to learn and debug APIs. API Inspector has the following features:
  • Automatic recording: To obtain related API calls, you only need to perform operations in the console. For more information, see Automatically record API calls.
  • Code generating with one click: API code scripts in different languages with pre-filled parameters are generated and can be run directly. For more information, see Generate API codes with one click.
  • Online debugging: When API Inspector is used together with OpenAPI Explorer and Cloud Shell, one-click online debugging can be implemented and you do not need to build the development environment. What you see is what you get. For more information, see Debug online through OpenAPI Explorer and Debug online through Cloud Shell.

Enable API Inspector

To enable API Inspector, follow these steps:

  1. Log on to the SLB console.
  2. In the lower-right corner of the page, click .

Automatically record API calls

In this topic, modifying the name of an SLB instance is taken as an example to demonstrate the automatic recording function of API Inspector.

  1. Choose Instances > Server Load Balancer.
  2. Modify the name of an SLB instance to SLB1.
  3. Click OK.
  4. Click on the right side of the page. Then you can see all API calls related to the preceding operation.

  5. You can click Hide Describe Class to view core APIs. In this example, the core API is SetLoadBalancerName.

Generate API codes with one click

After API recording is completed, click the API name to generate API code scripts in Python, Java, Go, Node.js, and PHP, with pre-filled parameters.

Note Click to copy the code scripts of the corresponding format, which can be run directly.


Debug online through OpenAPI Explorer

After the API recording is completed, click OpenAPI Explorer or to go to the OpenAPI Explorer console to debug the corresponding function. The API parameter values have been automatically generated according to operations in the console.



Note Click to view the document describing parameter details of the called API.

Debug online through Cloud Shell

After API recording, unfold the API calling details and click to use the online one-click debugging function of Cloud Shell.

Note If you use the one-click debugging function of Cloud Shell, we recommend that you create and associate an OSS bucket to store your frequently used scripts and files. However, some OSS fees will be generated. You can also choose not to create an OSS bucket.
The command format for the Cloud Shell debugging of SLB is as follows:
aliyun slb actionName --parameter1value1 --paramter2value2...
In this example, the called SetLoadBalancerName API modifies the name of the SLB instance to SLB1. The corresponding command is:
aliyun slb SetLoadBalancerName --RegionId cn-hangzhou --LoadBalancerName SLB1 --LoadBalancerId lb-bp1b6c719dfa08exfuca5

The returned value is:

{"RequestId":"14466282-B00F-49C1-B11E-FB8D3772E3DA"}