Quick Start
Advanced document
SDK example
Historical edition
Overview
The sample code in the document is for reference only. For more information about how to use the SDK, see SDK example and OpenAPI documentation.Publishing address
https://mvnrepository.com/artifact/com.aliyun/viapi_regen20211119/1.0.6Source repository address
https://github.com/aliyun/alibabacloud-java-sdk/tree/master/viapi-regen-20211119Installation Method
Apache Maven
Gradle Groovy DSL
Gradle Kotlin DSL
Scala SBT
Apache Ivy
Groovy Grape
Leiningen
Apache Buildr
Background information
- The following sample code shows how to use the Darabonba Java SDK. In this example, the CreateDataset API operation is called to initiate the
Create a data set
request.
Sample code
The SDK for Java provides the following sample code.
Procedure
- Initialize the com.aliyun.teaopenapi.models.Config object. The Config object stores configuration parameters such as AccessKeyId, AccessKeySecret, and Endpoint. For more information about endpoints, see viapi-regen.cn-hangzhou.aliyuncs.com in the example.
- Instantiate a client object from the com.aliyun.viapi_regen20211119.Client class. Generate subsequent requests and responses from the com.aliyun.viapi_regen20211119.models class.
- Create a request based on the required API operation. The class name is in the [APIName]Request format. Example:
- Set parameters for the request class. You must set the required properties for the request class.
- Obtain a response by using the client object.
- Obtain a response parameter by calling the corresponding property. Example:
- Use the catch() syntax to handle errors.