API Inspector is an experimental feature that allows you to view the API call that corresponds to each operation in the console. API Inspector can automatically generate API code snippets for each programming language. You can debug the API code snippets by using Cloud Shell and OpenAPI Explorer.

Features

API Inspector is integrated with OpenAPI Explorer and Cloud Shell to provide an integrated API learning and debugging solution with the following features:
  • Automatic recording: You can obtain relevant API calls by performing corresponding operations in the console. For more information, see Automatic recording.
  • Code generation: The system automatically generates API code snippets with preset parameters for different programming languages. You can directly run the API code snippets. For more information, see Code generation.
  • Online debugging: You can use OpenAPI Explorer and Cloud Shell to debug the code snippets without the need to build a developing environment. For more information, see Online debugging with OpenAPI Explorer and Online debugging with Cloud Shell.

Enable API Inspector

Perform the following operations to enable API Inspector:

  1. Log on to the Classic Load Balancer (CLB) console.
  2. Click api in the lower-right corner.

Automatic recording

The following example describes how to use the automatic recording feature in a scenario where you want to modify the name of a CLB instance in the console.

  1. Click the ID of the CLB instance that you want to manage and click the Instance Details tab.
  2. In the Basic Information section, click Edit to modify the name of the CLB instance.
  3. Click OK.
  4. Click 2 on the right of the page to view the API call that corresponds to the operation.

    You can select Hide Describe Class to view core API operations.

Code generation

After the API call that corresponds to the operation is recorded, click the name of the API. Then, the system generates the API code snippets with preset parameters in the following formats: Python, Java, Go, Node.js, PHP, and CLI.

Note Click to copy the code snippet in a specific format. You can directly run the code snippet.

Online debugging with OpenAPI Explorer

After the API call that corresponds to the operation is recorded, click OpenAPI Explorer to go to the OpenAPI Explorer page and debug the code snippet.

Note Click to view relevant documentation and parameters.

Online debugging with Cloud Shell

After the API call that corresponds to the operation is recorded, expand the details about the API call and click to debug the code snippet with Cloud Shell.

Note When you use Cloud Shell for debugging, we recommend that you create and associate an Object Storage Service (OSS) bucket to store common scripts and files. In this case, you are charged for using OSS. You can also choose not to use OSS.
Run a command in the following format to debug CLB API with Cloud Shell:
aliyun slb actionName --parameter1value1 --paramter2value2...
In this example, the API operation SetLoadBalancerName is performed to modify the name of the SLB1 instance. Therefore, run the following command:
aliyun slb SetLoadBalancerName --RegionId cn-hangzhou --LoadBalancerName SLB1 --LoadBalancerId lb-bp1b6c719dfa08exfuca5

The following value is returned:

null