大数据时代,是否还在为用户信息的真实性头疼不已?是否还在担心业务中出现冒名顶替的风险?是否还在为实现线上平台实名制而发愁?今天小编为您带来了实时联网、便于集成、快速核验的翔云身份证三要素+人像实名认证接口集成方式与代码调用。
以下是Java语言调用翔云身份证号实名认证API的代码:
package com.test;import okhttp3.*;
import org.json.JSONObject;
import java.io.*;
/*** 需要添加依赖* * * com.squareup.okhttp3* okhttp* 4.12.0* */
class Sample {static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build();public static void main(String []args) throws IOException{MediaType mediaType = MediaType.parse("text/plain");RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM).addFormDataPart("img","/9j").addFormDataPart("key","M***********g").addFormDataPart("secret","3***********6").addFormDataPart("trueName","陈**").addFormDataPart("idenNo","13***************3").addFormDataPart("typeId","3013").addFormDataPart("format","json").build();Request request = new Request.Builder().url("https://netocr.com/verapi/veridenOrd.do").method("POST", body).build();Response response = HTTP_CLIENT.newCall(request).execute();System.out.println(response.body().string());}
}