0


如何对接身份证实名认证?

阿里云身份证实名认证免费体验

身份证实名认证【最新版】_实名认证接口/API_数据API_电商-云市场-阿里云

Java代码如下

public static void main(String[] args) {
	    String host = "https://idcardcheck2.hzylgs.com";
	    String path = "/api-mall/api/id_card/check";
	    String method = "GET";
	    String appcode = "你自己的AppCode";
	    Map<String, String> headers = new HashMap<String, String>();
	    //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
	    headers.put("Authorization", "APPCODE " + appcode);
	    Map<String, String> querys = new HashMap<String, String>();
	    querys.put("idcard", "XXXXXXXXXXXXXXXXXX");
	    querys.put("name", "某某");

	    try {
	    	/**
	    	* 重要提示如下:
	    	* HttpUtils请从
	    	* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
	    	* 下载
	    	*
	    	* 相应的依赖请参照
	    	* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
	    	*/
	    	HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
	    	System.out.println(response.toString());
	    	//获取response的body
	    	//System.out.println(EntityUtils.toString(response.getEntity()));
	    } catch (Exception e) {
	    	e.printStackTrace();
	    }
	}

返回的结果 result 为0 代表实名认证成功

{
  "msg": "成功",
  "success": true,
  "code": 200,
  "data": {
    "birthday": "20020810",
    "result": 0,
    "address": "甘肃省*******静宁县",
    "orderNo": "202304021731265602998",
    "sex": "女",
    "desc": "一致"
  }
}

本文转载自: https://blog.csdn.net/u013128651/article/details/129958027
版权归原作者 北漂十年的码农 所有, 如有侵权,请联系我们删除。

“如何对接身份证实名认证?”的评论:

还没有评论