/api/e_invoice_qrcode_parser
1.接口描述
该 API 用于对二维码进行解析
请求方式
POST
请求 URL
http://server_host/api/e_invoice_qrcode_parser
2.请求参数
字段 | 类型 | 必需 | 描述 |
---|---|---|---|
request_id | string | 本次请求的id | |
image_file | file | 见下方注释 | 需上传的图片文件。上传本地图片进行检测时选取此参数 |
image_base64 | string | 见下方注释 | base64编码的图片内容 |
image_url | string | 见下方注释 | 网络影像的url地址 |
请求参数
image_file
、image_base64
、image_url
三选一。
url 中若含有特殊字符,则需要对这些字符进行转义,所有中文和特殊字符必需以UTF-8编码转义。
参数image_file
需把图片文件以 multipart/form-data 的形式放到 POST 消息体中。
3.返回参数
字段 | 类型 | 说明 |
---|---|---|
request_id | string | 本次请求的id |
status | string | 状态,正常为 OK |
time_cost | float | 接口耗时单位秒 |
result | object | 二维码解析结果 |
result
字段结构
字段 | 类型 | 说明 |
---|---|---|
text | string | 二维码解析原始文本 |
note_code | string | 发票代码 |
note_no | string | 发票号码 |
check_code | string | 校验码 |
total_cost | string | 总金额 |
billing_date | string | 开票日期 |
patient_name | string | 姓名 |
返回结果示例
{
"request_id": "TID36fcfa2a0f2041cb95f9baace01212b6",
"status": "OK",
"time_cost": 0.01,
"result": {
"text": "CZ-EI-31,1.1.0,356765121,1052432406110,406210,20210124,2851.41000",
"note_code": "356765121",
"note_no": "1052432406110",
"check_code": "406210",
"total_cost": "2851.41000",
"billing_date": "20210124",
"patient_name": null
}
}
4.错误码
状态码 | status 字段 |
说明 |
---|---|---|
400 |
INVALID_ARGUMENT | 请求参数错误 |
400 |
DETETION_FAILED | 图片检测失败 |
403 |
NO_PERMISSION | 无调用权限 |
403 |
OUT_OF_QUOTA | 调用次数超出限额 |
404 |
NOT_FOUND | 请求路径错误 |
500 |
INTERNAL_ERROR | 服务器内部错误 |
备注: 以上40X系列错误描述请参考error
字段
输出样例
{
"status": "PARAMETER_ERROR",
"error": "image_file、image_base64 or image_url required",
}