SDK code generation

更新时间:
复制 MD 格式

This topic shows you how to use OpenAPI Explorer to automatically generate Java SDK example code. The example uses the DescribeRegions API operation to query available Alibaba Cloud regions.

Get sample code

  1. Go to OpenAPI Explorer.

  2. Follow the steps in the table to get the SDK example code.

The table guides you through selecting an API operation and generating the code.

No.

Actions

At the top of the OpenAPI Explorer page, click the image.png icon, and then enter a product name in the search box. For example, enter ECS.

Select the API version. For example, select 2014-05-26 for ECS.

In the search box, enter the name of the API operation, and then click it when it appears in the search results.

For example, enter DescribeRegions.

Configure the request parameters for the DescribeRegions operation.

(Optional) Click Initiate Call. You may be charged for this call if the API operation is billable.

At the top of the right-side panel, click the SDK Sample Code tab.

Select the SDK version and language.

For example, select SDK version V2.0 and language Java.

Download the complete example project.

Copy the generated code example to integrate it into your project.

View the SDK information for the dependency installation command and release notes.

Note
  • In the upper-right corner of the SDK Sample Code area, click the 复制..png icon to copy the SDK example code.

  • At the top of the SDK Sample Code area, click Download Project to download the complete example project.