产品详情
API参数 长短信发送 调用地址: http,https://vslongsms.api.bdymkt.com/smsApi/group/v70 请求方式: POST 支持格式: application/json;charset=UTF-8 调用工具: 去调试 请求参数(Headers) 请求参数(Query)
- 名称
- 类型
- 是否必须
- 示例值
- 描述
- content
- string
- true
- 【中昱维信】您的账户已经充值成功,请尽快调试接口,谢谢!退订回TD
- 短信内容。需包含短信签名,短信内容+签名总字符数不得超过70个字符。
- phone
- string
- true
- 15618941090
- 接收短信的手机号码。 (只支持单个手机号)
- sendTime
- string
- false
- null
- 定时时间。留空则表示立即发送,时间格式为:yyyy-MM-dd HH:mm:ss
<dependency>
<groupId>com.baidubce</groupId>
<artifactId>api-explorer-sdk</artifactId>
<version>1.0.0</version>
</dependency>
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 //成功条数
}
错误码定义
