API: voice/verify
概览
voice/verify
是 SUBMAIL 的语音验证码 API 。
集成语音验证码 API 可以让您的网站或应用具备语音验证码功能,在某些极端条件下短信无法送达至用户手机时,语音验证码以电话的形式主动呼叫用户手机,自动语音播报验证码或校验码以达到验证用户身份的目的。
voice/verify
已内置语音播报模板,开发者在发起API请求时,传入4位数字验证码,即可完成API请求。
URL
<主> https://api.mysubmail.com/voice/verify
<备> https://api.submail.cn/voice/verify
支持格式
格式 | URL |
---|---|
json | https://api.mysubmail.com/voice/verify.json (默认) |
xml | https://api.mysubmail.com/voice/verify.xml |
http 请求方式
请求方式 | content-type设置 |
---|---|
http post | multipart/form-data 、x-www-form-urlencoded 、application/json |
是否需要授权
是
参阅 API 授权和验证机制
请求参数
参数 | 类型 | 必需/可选 | 默认 | 描述 |
---|---|---|---|---|
appid | string | 必需 | 无 | 在 SUBMAIL 应用集成中创建的语音应用 ID |
to | string | 必需 | 无 | 收件人11位手机号码(仅支持单个手机号码) |
code | int | 必需 | 无 | 4-10位数字(此数字为语音播报的4-10位数字验证码) |
timestamp | UNIX 时间戳 | 可选 | 无 | 参阅 API 授权与验证机制 > Timestamp UNIX 时间戳 |
sign_type | string | 可选 | normal | API 授权模式( md5 or sha1 or normal )参阅 API 授权与验证机制 > 授权和验证方式 |
signature | string | 必需 | 无 | 应用密匙或数字签名 参阅 API授权与验证机制 > 授权和验证方式 |
代码示例
发送一封测试语音
POST URL
https://api.mysubmail.com/voice/verify.json
POST DATA
appid=your_app_id
&to=138xxxxxxxx
&code=1234
&signature=your_app_key
返回
{
"status":"success"
"send_id":"093c0a7df143c087d6cba9cdf0cf3738"
"money_account":14197
}
使用 CURL
发送一封测试短信
发送 CURL
curl -d 'appid=your_app_id&to=138xxxxxxxx&code=1234&signature=your_app_key' https://api.mysubmail.com/voice/verify.json
返回
{
"status":"success"
"send_id":"093c0a7df143c087d6cba9cdf0cf3738"
"money_account":"100.95"
}
返回值
请求成功
{
"status":"success"
"send_id":"093c0a7df143c087d6cba9cdf0cf3738"
"money_account":"100.95"
}
请求失败
{
"status":"error",
"code":"1xx",
"msg":"error message"
}