身份证核验也就是核查身份证的真实性,虽然现有的技术越来越强,但是利益驱使下,不法分子也在想尽各种办法来利用非真实的身份证来实施违法行为。翔云身份证核验接口就可随时为用户提供核查身份证真伪的接口,让实名认证政策落地。
以下是Android语言调用翔云身份实名认证API的代码:
import android.util.Log;
import okhttp3.*;
import java.io.IOException;public class Sample {private static final OkHttpClient HTTP_CLIENT = new OkHttpClient.Builder().build();public static void performNetworkRequest() {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("typeId", "3012").addFormDataPart("trueName", "陈**").addFormDataPart("idenNo", "13***************3").addFormDataPart("format", "json").build();Request request = new Request.Builder().url("https://netocr.com/verapi/veridenCardOrd.do").method("POST", body).build();HTTP_CLIENT.newCall(request).enqueue(new Callback() {@Overridepublic void onFailure(Call call, IOException e) {Log.e("Sample", "Error: " + e.getMessage());// 处理请求失败情况}@Overridepublic void onResponse(Call call, Response response) throws IOException {if (response.isSuccessful()) {String responseData = response.body().string();// 在这里处理响应结果Log.d("Sample", "Response: " + responseData);} else {Log.e("Sample", "Response code: " + response.code());// 处理响应失败情况}}});}
}