本文为您介绍了在使用接口前你需要做的准备工作和示例参考。

开发准备

<dependency>
  <groupId>com.aliyun</groupId>
  <artifactId>aliyun-java-sdk-core</artifactId>
  <version>4.4.8</version>
</dependency>

<dependency>
  <groupId>com.aliyun</groupId>
  <artifactId>aliyun-java-sdk-aiccs</artifactId>
  <version>1.1.0</version>
</dependency>

代码示例

说明 instanceId为阿里云开通实例ID,可在智能联络中心阿里云控制台查询。
DefaultProfile profile = DefaultProfile.getProfile("cn-shanghai", accessKey, accessSecret);
IAcsClient client = new DefaultAcsClient(profile);

GetAgentRequest request = new GetAgentRequest();
request.setRegionId("cn-shanghai");
request.setEndpoint("aiccs.aliyuncs.com");
request.setInstanceId("agent_12345");
request.setAccountName("hellouser");

try {
    GetAgentResponse response = client.getAcsResponse(request);
    System.out.println(JSON.toJSONString(response));
}
catch (Exception e) {
    e.printStackTrace();
}