tencent cloud

Feedback

Integration Process

Last updated: 2023-11-29 16:00:14
    This article describes the overall access process of liveness face comparison in API mode. You can integrate it using any language you are familiar with because this API is language independent. However, before using API to integrate liveness face comparison services, you'd better be able to read and understand Connecting to Tencent Cloud API, which tells you how to use Tencent Cloud SDK to simplify the API access process. In this article, we only demonstrate how to integrate our APIs using Java API SDK.

    Preparing for Access

    Register a Tencent Cloud enterprise account. Refer to Signing Up.
    Complete the enterprise identity verification. Refer to Enterprise Identity Verification Guide.
    Log in to FaceID console to Open Service.
    Obtain API access key.

    Introducing Tencent Cloud API SDK

    <dependency>
    <groupId>com.tencentcloudapi</groupId>
    <artifactId>tencentcloud-sdk-java-intl-en</artifactId>
    <version>3.0.798</version>
    </dependency>

    Initializing and Configuring API SDK Client

    // Instantiate an authentication object. The Tencent Cloud account `secretId` and `secretKey` need to be passed in as the input parameters
    Credential cred = new Credential("secretId", "secretKey");
    
    // Instantiate the client object of the requested product
    ClientProfile clientProfile = new ClientProfile();
    clientProfile.setSignMethod(ClientProfile.SIGN_TC3_256);
    
    FaceidClient client = new FaceidClient(cred, "ap-singapore", clientProfile);

    Calling the CompareFaceLiveness API

    // Step 1: Instantiate the request object and provide necessary parameters
    CompareFaceLivenessRequest request = new CompareFaceLivenessRequest();
    request.setLivenessType("SILENT");
    request.setImageBase64(getBase64(cmd.getOptionValue(IMAGE_PATH)));
    request.setVideoBase64(getBase64(cmd.getOptionValue(VIDEO_PATH)));
    
    // Step 2: Call the Tencent Cloud API through FaceIdClient
    CompareFaceLivenessResponse response = client.CompareFaceLiveness(request);
    
    // Step 3: Process the Tencent Cloud API response and construct the return object
    System.out.println(CompareFaceLivenessResponse.toJsonString(response));

    Usage Example

    You can view full sample source code at GitHub repository:

    API Documentation

    You can view full API documentation on Tencent Cloud official website:
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support