import com.baidubce.http.ApiExplorerClient; import com.baidubce.http.AppSigner; import com.baidubce.http.HttpMethodName; import com.baidubce.model.ApiExplorerRequest; import com.baidubce.model.ApiExplorerResponse; // 身份证二要素验证_专业版 Java示例代码 public class RequestDemo { public static void main(String[] args) { String path = "https://jumssread.api.bdymkt.com/idcard/validate"; ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.POST, path); request.setCredentials("您的 access key", "您的 secret key"); request.addHeaderParameter("Content-Type", "application/x-www-form-urlencoded"); request.addQueryParameter("name", ""); request.addQueryParameter("idCardNo", ""); ApiExplorerClient client = new ApiExplorerClient(new AppSigner()); try { ApiExplorerResponse response = client.sendRequest(request); // 返回结果格式为Json字符串 System.out.println(response.getResult()); } catch (Exception e) { e.printStackTrace(); } } }
点击复制代码
{
"code": 200,
"msg": "成功",
"taskNo":"121312312321312321" // 本次请求号
"data": {
"result": 1, //0 一致,1 不一致
"desc": "不一致", //描述
"sex": "男", //性别
"birthday": "19940320", //生日
"address": "杭州市西湖区余杭塘路" //地址
}
}
{
"code": 400, // 请查阅错误码定义
"msg": "入参错误"
}
1,官方直连,权威校验;2,全实时优质接口,不参缓存,品质保证;3,多通道冗余切换,稳定可靠