# 语音通知发送接口


# 接口地址

http://api.1cloudsp.com/noticevoice/api/v2/send

用户通过HTTP(或HTTPS)的POST或GET方式提交短信发送请求。编码采用UTF-8编码。


# 请求参数

参数名 是否必填 类型 示例 描述
accesskey String xxxxxxxxxx 秘钥key
secret String yyyyyyyyyy 秘钥secret
templateId String 123456 平台上申请的接口短信模板Id(须审核通过)
mobile String 13900000000,13900000001 接收短信的手机号码,多个号码以半角逗号,隔开
content String 先生##9:40##快递公司##1234567(示例模板:{1}您好,您的订单于{2}已通过{3}发货,运单号{4}) 发送的短信内容是模板变量内容,多个变量中间用##隔开,采用utf8编码

# 请求示例

/* ---示例代码 POST方式----*/

    //普通短信通知
    private void sendsms() throws Exception {
        HttpClient httpClient = new HttpClient();
        PostMethod postMethod = new PostMethod("http://api.1cloudsp.com/noticevoice/api/send/v2");
        postMethod.getParams().setContentCharset("UTF-8");
        postMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,new DefaultHttpMethodRetryHandler());

        String accesskey = "xxxxxxxxxx"; //用户开发key
        String accessSecret = "yyyyyyyyyy"; //用户开发秘钥

        NameValuePair[] data = {
                new NameValuePair("accesskey", accesskey),
                new NameValuePair("secret", accessSecret),
                new NameValuePair("templateId", "100"),
                new NameValuePair("mobile", "13900000001,13900000002"),
                new NameValuePair("content", URLEncoder.encode("先生##9:40##快递公司##1234567", "utf-8"))//(示例模板:{1}您好,您的订单于{2}已通过{3}发货,运单号{4})
        };
        postMethod.setRequestBody(data);
        postMethod.setRequestHeader("Connection", "close");

        int statusCode = httpClient.executeMethod(postMethod);
        System.out.println("statusCode: " + statusCode + ", body: "
                    + postMethod.getResponseBodyAsString());
    }

/* ---示例代码 POST方式----*/

# 返回示例

{
    "code": "0",
    "msg": "SUCCESS",
    "batchId": ""
}