OpenAPI Explorer can automatically generate Java, Python, PHP and Node.js SDK examples based on your API request.
This topic describes how to obtain dynamic sample code and call API operations. For information about Alibaba Cloud SDKs, see Alibaba Cloud SDKs.
Procedure
Download the project code
Log on to OpenAPI Explorer.
In the top navigation bar, move the pointer over Cloud Products and find the cloud service that you want to manage.
Click the service name to go to Product Homepage. In the upper-right corner of the page, click Debug. A page with three columns appears.
Select the API operation that you want to call in the leftmost column. Configure the required parameters in the middle column. Then, click the SDK Sample Code tab in the rightmost column.
Select V2.0 from the SDK Version drop-down list and select a language based on your business requirements.
Click Download Project to download the sample code.
If you want to generate the sample code of a generic call, turn on Common Request. For more information, see Generic calls and specialized calls.
Create a user identity and logon credentials
You can call API operations by using an Alibaba Cloud account or a Resource Access Management (RAM) role, or as a RAM user. For more information about the differences between the identities, see Identity, credential, and authorization.
Configure environment variables
Configure the ALIBABA_CLOUD_ACCESS_KEY_ID
and ALIBABA_CLOUD_ACCESS_KEY_SECRET
environment variables. For more information, see Set environment variables in the Linux, macOS, or Windows operating system.
Run the code
Decompress the downloaded package and use IDEA to open the project.
Add the Maven dependency.
Click Run.