API: Factor/simple - 简版运营商三要素


概览



factor/simple 是 SUBMAIL 的简版身份验证 API,根据身份证、手机号和姓名验证是否为本人。



URL


<主> http://tpa.mysubmail.com/factor/simple

<备> https://tpa.mysubmail.com/factor/simple



支持格式


格式URL
jsonhttps://tpa.mysubmail.com/factor/simple.json(默认)
xmlhttps://tpa.mysubmail.com/factor/simple.xml


http 请求方式


请求方式content-type 设置
http postmultipart/form-datax-www-form-urlencodedapplication/json


请求参数


参数类型必需/可选默认描述
appidstring必需三要素 appid,自控制台获取
timestampstring必需时间戳
namestring必需待验证的身份证姓名
idNostring必需待验证的身份证号码
mobilestring必需待验证的号码
signaturestring必需sha256加密校验数字证书


signature创建规则



1.请将以下参数按照字段升序(A-Z)排列
appkey、idNo 、mobile、name、timestamp

2.创建签名字符串 :以"key=value" + "&"(连接符)+ "key=value" 的方式连接所有参数

3.创建签名:拼接签名字符串示例string = "appkey=xxxx&idNo=xxxx&mobile=188xxxx&name=张三& timestamp=1614759954",然后使用sha256(string)创建签名

注:中文需要使用urlencode处理后再参与创建签名


代码示例


发送验证到


POST

http://tpa.mysubmail.com/factor/simple

POST Data
appid=your_app_id
& timestamp=1605521294832
&name=张三
&idNo=310000xxxxxxxxxxxx
&mobile=130xxxxxxxx
&signature=sha256加密后字符串


返回
{

​    "status": "success",

​    "result": {

​       "provider": "中国联通",

​       "identical": "true"

​     },

​    "send_id": "4cf22ecb12342a5442df58c829a86690"

}
status:接口请求状态        identical:认证结果,true匹配/false不匹配        send_id:唯一的请求标识
provider:运营商


请求失败
{

​    "status": "error",

​    "code": 1210,

​    "msg": "Empty APP ID."

}
status:接口请求状态        code:错误代码        msg:错误信息


错误代码


参阅 API 错误代码