文档

调用方式

更新时间:

服务地址

接入地址为:chatbot.cn-shanghai.aliyuncs.com

Region:cn-shanghai

Product:Chatbot

Version:2017-10-11

接入方式参考 阿里云Java SDK开发指南 > 快速开始 ,如果Maven没有从中央存储库下载jar包,则需要将此依赖项添加到pom.xml文件中,否则将报告NoClassDefFoundError 异常。

<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";
   String popRegion = "cn-shanghai";
   String popProduct = "Chatbot";
   String popDomain = "chatbot.cn-shanghai.aliyuncs.com";
   DefaultProfile.addEndpoint(popRegion, popProduct, popDomain);
   IClientProfile profile = DefaultProfile.getProfile(popRegion, accountAccessAK, accountAccessSK);
   DefaultAcsClient client = new DefaultAcsClient(profile);
   //固定入参
   CommonRequest commonRequest = new CommonRequest();
   commonRequest.setSysProduct("Chatbot");
   commonRequest.setSysMethod(MethodType.GET);
   //根据API会有变化
   commonRequest.setSysAction("GetBotSessionData");
   //数据看板SysVersion使用2017-10-11
   commonRequest.setSysVersion("2017-10-11");
   //机器人id
   commonRequest.putQueryParameter("RobotInstanceId", "chatbot-cn-7QuUfaqMQ");
   //查询开始时间
   commonRequest.putQueryParameter("StartTime", "20201108");
   //查询结束时间
   commonRequest.putQueryParameter("EndTime", "20201207");
   CommonResponse commonResponse = client.getCommonResponse(commonRequest);
   System.out.println(commonResponse.getData());
}
                

  • 本页导读 (0)
文档反馈