API: Factor/idcard
概览
factor/idcard
是 SUBMAIL 的简版身份验证 API,根据身份证号和姓名验证是否为本人。
URL
<主> http://tpa.mysubmail.com/factor/idcard
<备> https://tpa.mysubmail.com/factor/idcard
支持格式
格式 | URL |
---|---|
json | https://tpa.mysubmail.com/factor/idcard.json (默认) |
xml | https://tpa.mysubmail.com/factor/idcard.xml |
http 请求方式
请求方式 | content-type 设置 |
---|---|
http post | multipart/form-data 、x-www-form-urlencoded 、application/json |
请求参数
参数 | 类型 | 必需/可选** | 默认 | 描述 |
---|---|---|---|---|
appid | string | 必需 | 无 | 三要素应用 appid,自控制台获取 |
timestamp | string | 必需 | 无 | 时间戳 |
name | string | 必需 | 无 | 待验证的身份证姓名 |
idNo | string | 必需 | 无 | 待验证的身份证号码 |
signature | string | 必需 | 无 | sha256 数据加密校验证书 |
signature创建规则
1.请将以下参数按照字段升序(A-Z)排列
appkey、idNo 、name、timestamp
2.创建签名字符串 :以"key=value" + "&"(连接符)+ "key=value" 的方式连接所有参数
3.创建签名:拼接签名字符串示例string = "appkey=xxxx&idNo =xxxxx&name=张三& timestamp=1614759954",然后使用sha256(string)创建签名
注:中文需要使用urlencode处理后再参与创建签名
代码示例
发送验证到
POST
http://tpa.mysubmail.com/factor/idcard
POST Data
appid=your_app_id
& timestamp=1605521294832
&name=张三
&idNo=310000xxxxxxxxxxxx
&signature=sha256加密后字符串
返回
{
"status":"success",
"identical":"true",
"send_id":"69639b23cbd2933746d87397bc379ab7"
}
status:接口请求状态 identical:认证结果,true匹配/false不匹配 send_id:唯一的请求标识
请求失败
{
"status": "error",
"code": 1210,
"msg": "Empty APP ID."
}
status:接口请求状态 code:错误代码 msg:错误信息