短信发送记录查询接口(QuerySendDetails)
用于查询短信发送的状态,是否成功到达终端用户手机
入参列表
出参列表
Demo样例
技术对接步骤
1:下载SDK工具包
SDK工具包中一共包含了2个类库,一个aliyun-java-sdk-core包,另外一个是alicom-dysms-api包,将这两个包执行mvn package命令或者mvn deploy命令打包出相应的jar包,添加到工程类库中依赖使用。
SDK&DEMO[
下载地址]
2: 编写样例程序
```java //设置超时时间 System.setProperty(“sun.net.client.defaultConnectTimeout”, “10000”); System.setProperty(“sun.net.client.defaultReadTimeout”, “10000”);<pre style='background: rgb(246, 246, 246); font: 12px/1.6 "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; padding: 10px; outline: 0px; border-radius: 3px; border: 1px solid rgb(221, 221, 221); color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: auto; margin-top: 0px; margin-right: 0px; margin-bottom: 0px !important; margin-left: 0px; word-spacing: 0px; white-space: pre-wrap; word-wrap: break-word; box-sizing: border-box; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;' prettyprinted?="" linenums="">
- //云通信产品-短信API服务产品名称(短信产品名固定,无需修改)
- final String product = "Dysmsapi";
- //云通信产品-短信API服务产品域名(接口地址固定,无需修改)
- final String domain = "dysmsapi.aliyuncs.com";
- //此处需要替换成开发者自己的AK信息
- final String accessKeyId = "yourAccessKeyId";
- final String accessKeySecret = "yourAccessKeySecret";
- //初始化ascClient
- IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
- DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
- IAcsClient acsClient = new DefaultAcsClient(profile);
- //组装请求对象
- QuerySendDetailsRequest request = new QuerySendDetailsRequest();
- //必填-号码
- request.setPhoneNumber("150000000");
- //可选-调用发送短信接口时返回的BizId
- request.setBizId("1234567^8901234");
- //必填-短信发送的日期 支持30天内记录查询(可查其中一天的发送数据),格式yyyyMMdd
- request.setSendDate("20170543");
- //必填-页大小
- request.setPageSize(10L);
- //必填-当前页码从1开始计数
- request.setCurrentPage(1L);
- //hint 此处可能会抛出异常,注意catch
- QuerySendDetailsResponse querySendDetailsResponse = acsClient.getAcsResponse(request);
- //获取返回结果
- if(querySendDetailsResponse.getCode() != null && querySendDetailsResponse.getCode().equals("OK")){
- //代表请求成功
- }