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
-
Go to OpenAPI Explorer.
-
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 |
|
② |
Select the API version. For example, select |
|
③ |
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 |
|
④ |
Configure the request parameters for the |
|
⑤ |
(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 |
|
⑧ |
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. |
-
In the upper-right corner of the SDK Sample Code area, click the
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.
icon, and then enter a product name in the search box. For example, enter ECS.