import com.baidubce.http.ApiExplorerClient; import com.baidubce.http.AppSigner; import com.baidubce.http.HttpMethodName; import com.baidubce.model.ApiExplorerRequest; import com.baidubce.model.ApiExplorerResponse; // 短信发送接口 Java示例代码 public class RequestDemo { public static void main(String[] args) { String path = "http://gwgp-pdq3uhmmppu.n.bdcloudapi.com/smsApi/group/v70"; ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.POST, path); request.setCredentials("您的 access key", "您的 secret key"); request.addHeaderParameter("Content-Type", "application/json;charset=UTF-8"); request.addQueryParameter("content", ""); request.addQueryParameter("phone", ""); request.addQueryParameter("sendTime", ""); ApiExplorerClient client = new ApiExplorerClient(new AppSigner()); try { ApiExplorerResponse response = client.sendRequest(request); // 返回结果格式为Json字符串 System.out.println(response.getResult()); } catch (Exception e) { e.printStackTrace(); } } }
点击复制代码
{
"returnStatus": "1 ", //状态码
"message": "成功", //状态提示信息
"remainpoint": "241", //本次发送后,账户剩余条数
"taskId": "3313746", //下发批次ID(唯一)
"successCounts": "1" //成功条数
}
{
"returnStatus": "0", //状态码
"message": "参数错误", //状态提示信息
"remainpoint": null, //本次发送后,账户剩余条数
"taskId": null, //下发批次ID(唯一)
"successCounts": null //成功条数
}
服务特别说明:
(1)营销短信需包含签名,签名通常是企业简称或品牌名称,末尾需要增“退订回TD”字样,签名+内容+末尾退订提醒总字符数不得超过70字;
(2)短信经系统审核后下发,禁止发送黄赌毒等法律法规严禁传播的信息,如有违规,立即封禁账户;
(3)工作日30分钟内审核完毕,节假日1-2个小时审核完毕,如需加急审核请电话联系客服;
(4)如您有任何问题,请拨打400-68-10658服务热线,或添加客服微信:15618941090。