Invocation methods
This product provides a software development kit (SDK) for Java. You can use the SDK to bypass manual API signature calculations and quickly integrate product features. Note: You must desensitize all data that you transmit through API operations. Ensure that the transmitted data does not contain personal information.
SDK calls
For information about how to use the Alibaba Cloud Java SDK core package, see Alibaba Cloud Java SDK Developer Guide > QuickStart.
Add the following dependency to your pom.xml file to use the retailbot Java SDK.
The latest version number may change during the public preview. Contact our technical team to obtain the latest version number.
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>retailbot20210224</artifactId>
<version>1.8.0</version>
</dependency>Using the Alibaba Cloud common SDK
For more information, see Alibaba Cloud Java SDK Developer Guide > QuickStart. If Maven fails to download the JAR package from the central repository, you must add this dependency to your pom.xml file to prevent a NoClassDefFoundError exception.
You can download the latest version from the official Alibaba Cloud website.
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.5.2</version>
</dependency>public static void main(String[] args) throws Exception{
String accountAccessAK = "XXXXXXXXXXXXXXXXXX";
String accountAccessSK = "XXXXXXXXXXXXXXXXXX";
// The following POP information is provided after consultation.
String popRegion = "xxx";
String popProduct = "xxx";
String popDomain = "xxx";
DefaultProfile.addEndpoint(popRegion, popProduct, popDomain);
IClientProfile profile = DefaultProfile.getProfile(popRegion, accountAccessAK, accountAccessSK);
DefaultAcsClient client = new DefaultAcsClient(profile);
// Fixed request parameters
CommonRequest commonRequest = new CommonRequest();
commonRequest.setSysProduct("xxx");
commonRequest.setSysMethod(MethodType.GET);
// Varies based on the API operation
commonRequest.setSysAction("xxx");
commonRequest.setSysVersion("2017-10-11");
commonRequest.putQueryParameter("Utterance", "xxx");
// The robot ID
commonRequest.putQueryParameter("InstanceId", "xxxxxxxxxxxx");
CommonResponse commonResponse = client.getCommonResponse(commonRequest);
System.out.println(commonResponse.getData());
}