All Products
Search
Document Center

Alibaba Cloud SDK:Automatically generate SDK sample code

Last Updated:Jun 18, 2026

You can use OpenAPI Explorer to automatically generate SDK sample code for any API operation.

Scenario

This example generates Java SDK sample code for the DescribeRegions operation of Elastic Compute Service (ECS) to query available regions.

Procedure

  1. Visit OpenAPI Explorer.

  2. Perform the steps shown in the following figure to generate SDK sample code.

image

The following table describes each step in the preceding figure.

No.

Operation

1

On the OpenAPI Explorer homepage, hover over Cloud Products in the top navigation bar and enter the cloud service name in the search box. ECS is used in this example.

2

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

3

Enter the API operation name in the search box and click it in the search results.

DescribeRegions is used in this example.

4

Specify the request parameters of the DescribeRegions operation.

5

Optional. Click Initiate Call. You may be charged based on the billing rules of the API operation.

6

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

7

Select the SDK version and programming language.

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

8

Download the complete sample code for a sample SDK project.

9

Copy the sample code that is generated in the code editor.

10

View the SDK installation information, including the installation command and release report.

Note
  • In the upper-right corner of the code editor, click the Copy..png icon to copy the SDK sample code.

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