接口地址

http://e.cryun.com/#share/2572(接口地址平台)

http://api.1cloudsp.com/voice/send

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


#请求参数

参数名 是否必填 类型 示例 描述
accesskey String xxxxxxxxxx 秘钥key
secret String yyyyyyyyyy 秘钥secret
mobile String 13900000001 接收语音短信的手机号码,多个号码以半角逗号,隔开
voiceCode String 123456 语音数字,4~8位数字

#请求示例

/* ---示例代码 POST方式----*/
                
HttpClient httpClient = new HttpClient();
PostMethod postMethod = new PostMethod("http://api.1cloudsp.com/voice/send");
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("mobile", "13900000001"),
        new NameValuePair("voiceCode", "123456"),
};
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"
}
Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐