操作步骤
1、API文档说明
人脸核身服务端
2、pom.xml
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.4.8</version>
</dependency>
3、Java Code Sample
package org.example;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
public class ExecuteServerSideVerification {
public static void main(String[] args) {
DefaultProfile profile = DefaultProfile.getProfile("cn-shanghai", "<accessKey>", "<accessSecret>");
IAcsClient client = new DefaultAcsClient(profile);
CommonRequest request = new CommonRequest();
request.setMethod(MethodType.POST);
request.setDomain("facebody.cn-shanghai.aliyuncs.com");
request.setVersion("2020-09-10");
request.setUriPattern("/viapi/thirdparty/realperson/execServerSideVerification");
request.putHeadParameter("Content-Type", "application/json");
request.putQueryParameter("certificateName","张三"); // 姓名
request.putQueryParameter("certificateNumber","1281739873298172981"); // 身份证号码
request.putQueryParameter("sceneType","server");
request.putQueryParameter("facialPictureUrl","https://******.oss-cn-shanghai.aliyuncs.com/*****.jpg"); // 身份证照片
try {
CommonResponse response = client.getCommonResponse(request);
System.out.println(response.getData());
} catch (ServerException e) {
e.printStackTrace();
} catch (ClientException e) {
e.printStackTrace();
}
}
}
4、The Result
{"RequestId":"15E9D7A1-03F7-52E5-9646-B7**********","Data":{"Pass":true,"VerificationToken":"447c1f408f714b2bc053cbbf**********","Reason":"认证通过(Z8120)"}}
更多参考
阿里云视觉智能开放平台金融级人脸核身服务端PHP接入示例