C# SDK
using System;using System.Collections.Generic;using System.Web;using System.Net;using System.Text;public class getIDCardInfo{public static string getInfo(string appid, string appkey, string module, string idcard){string url = string.Format("http://cha.ebaitian.cn/api/json?type=get&appid={0}&module={1}&idcard={2}&sgin={3}", appid, module, idcard, sgin);using (WebClient client = new WebClient()){client.Encoding = Encoding.UTF8;return client.DownloadString(url);}}}string idcardInfo = getIDCardInfo.getInfo("1000xxxx", "getIDCardInfo", "420101199001010000", "ecab4881ee80ad3d76bb1da68387428ca752eb885e52621a3129dcf4d9bc4fd4", Request.UserHostAddress);Console.WriteLine(idcardInfo);Response.Write(idcardInfo);JavaScript SDK
方法一:以 POST 方式请求数据//使用 JQuery 请先加载最新的 JQuery 插件//参数设置var apiurl = 'http://cha.ebaitian.cn/api/json';var appid = '1000xxxx';var appkey = '56cf61af4b7897e704f67deb88ae8f24';var module = 'getIDCardInfo';//目标查询身份证号码var idcard='420101199001010000';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256var sign = SHA256('appid='+appid+'&module='+module+'&idcard='+idcard+'&appkey='+appkey);//提交数据$.ajax({url:apiurl,type:'post',dataType:'json',data:{appid:appid,module:module,idcard:idcard,sign:sign},success:function(res){console.log(res);}});方法二:以 GET 方式请求数据
//使用 JQuery 请先加载最新的 JQuery 插件//参数设置var apiurl = 'http://cha.ebaitian.cn/api/json';var appid = '1000xxxx';var appkey = '56cf61af4b7897e704f67deb88ae8f24';var module = 'getIDCardInfo';//目标查询身份证号码var idcard='420101199001010000';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256var sign = SHA256('appid='+appid+'&module='+module+'&idcard='+idcard+'&appkey='+appkey);//提交数据$.ajax({url:apiurl,type:'post',dataType:'json',data:{appid:appid,module:module,idcard:idcard,sign:sign},success:function(res){console.log(res);}});ASP SDK
'设置参数dim apiurl, appid, appkey, module, idcard, signapiurl="http://cha.ebaitian.cn/api/json"appid="1000xxxx'appkey="56cf61af4b7897e704f67deb88ae8f24"module="getIDCardInfo"idcard="420101199001010000"'签名,SHA256 不可直接调用;函数参考地址:https://blog.csdn.net/yesoce/article/details/128546sgin=SHA256("appid=&appid&"&module="&module&"&idcard="&idcard&"&appkey="&appkey)'异步提交数据function PostHTTPPage(url,data)dim Httpset Http=server.createobject("MSXML2.SERVERXMLHTTP.3.0")Http.open "POST",url,falseHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"Http.send(data)if Http.readystate<>4 thenexit functionEnd ifPostHTTPPage=bytesToBSTR(Http.responseBody,"UTF-8")set http=nothingif err.number<>0 then err.ClearEnd function'提交数据dim postdata, strTestpostdata=https://www.isolves.com/it/cxkf/bk/2022-07-02/"appid=&appid&"&module="&module&"&idcard="&idcard&"&sign="&signstrTest=PostHTTPPage(apiurl,postdata)'返回结果response.write(strTest)response.end常见问题API 接口参数为空
此错误返回 JSON 数据如下:
Copy
{
"result":0,
"description":"API接口参数为空",
"flag":"appid:sign"
}
解决方法:
1)请检查 appid 及 sign 是否为空;
2)确保 appid 是从官网获取到正确的接口授权;
3)确保 sign 计算生成是正确的 。
API 接口参数无效
此错误返回 JSON 数据如下:
Copy
{
"result":0,
"description":"API接口参数无效",
"flag":"appid"
}
解决方法:
1)请检查 appid 是否正确;
2)确保 appid 是从官网获取到正确的接口授权 。
API 接口授权已到期
此错误返回 JSON 数据如下:
Copy
{
"result":0,
"description":"API接口授权已到期",
"flag":"end:2018-12-31 23:59:59"
}
解决方法:
1)请检查 appid 对应接口授权的期限是否过期;
2)如果接口授权过期,请到官网更新(免费用户直接更新,无需续费)或续费(针对商业付费用户) 。
签名错误
此错误返回 JSON 数据如下:
Copy
{
"result":0,
"description":"签名错误",
推荐阅读
- 网剧中披露他人手机号码构成侵权-披露他人隐私如何处理
- 网剧中披露他人手机号码构成侵权-电视剧中的手机号码真的假的
- 96110是什么号码-96110为什么给我打电话-96110是诈骗电话吗
- 身份证哪一面是正面?
- 没有身份证怎么坐高铁?
- 江西嫌犯案发前住旅店拒刷身份证-江西嫌犯落网
- 江西嫌犯案发前住旅店拒刷身份证-曾春亮曾前往旅店
- 张玉环儿子称拒绝任何形式捐款-张玉环无罪释放后办理新身份证
- 张玉环将控告涉案司法人员-张玉环办理新身份证
- 张玉环无罪释放后办理新身份证-张玉环无罪释放后前往当地派出所办理新身份证
