Skip to main content

Autonomous integration

The default implementation of worksheet OCR fields in HAP products is based on Tencent Cloud's OCR service. Currently, three types of APIs are mainly used: General OCR, ID card OCR (FRONT), and Invoice OCR.

The corresponding interfaces are as follows:

The key parameters of the above three interfaces are mainly the X-TC-Action in the request header (corresponding to the API type) and the ImageURL in the request body (corresponding to the relevant image resource addresses in HAP products).

In the autonomous integration mode, developers need to encapsulate interfaces and meet the input and output formats of the corresponding interfaces. It can be understood that the HAP product originally called the Tencent Cloud interface, but now it calls an independently implemented interface, and the input and output of the interface are completely consistent with Tencent Cloud.For example: Example code based on Baidu OCR autonomous integration

After the interface development is completed and deployed, go to HAP System Configuration>Integration>OCR, select the type of autonomous integration, configure the service address (baseURL), and theoretically fill in any value for ID and key, as shown in the following figure: