All Products
Search
Document Center

OpenAPI Explorer:Automatic generation of SDK examples

Last Updated:Jun 06, 2024

This topic describes how to automatically generate SDK examples for API operations in OpenAPI Explorer. In the example, an SDK example in Java for the DescribeRegions operation of Elastic Compute Service (ECS) is generated. The operation is used to query the available regions.

Procedure

  1. Visit OpenAPI Explorer.

  2. Perform the steps shown in the following figure to download a sample SDK project.

image

The following table describes the specific operations of each step in the above figure.

No.

Operation

On the OpenAPI Explorer homepage, move the pointer over Cloud Products in the top navigation bar. Then, enter the name of the cloud service that you want to manage in the search box. ECS is used in this example.

Check the version of the API. The API version is 2014-05-26 in this example.

Enter the name of the API operation that you want to call in the search box. Then, click the API operation in the search result.

DescribeRegions is used in this example.

Specify the request parameters of the DescribeRegions operation.

Optional. Click Initiate Call. You may be billed depending on the billing policy of the API operation.

In the upper part of the rightmost column, click the SDK Sample Code tab.

Select the SDK version and language based on your business requirements.

In this example, V2.0 is selected as the SDK version and Java is selected as the language.

Download the complete sample SDK project.

Copy the code example that is generated on the page.

View the SDK information to obtain the installation command and release report.

Note
  • In the upper-right corner of the editor, you can click the 复制..png icon to copy the SDK code example.

  • In the upper part of the SDK Sample Code tab, you can click Download Project to download the complete sample SDK project.