/api/bankcard
1.接口描述
该 API 用于识别银行卡图像上的文字信息。
请求方式
POST
请求 URL
http://server_host/api/bankcard
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 | objcet | 检测结果,详见result 中字段的结构 |
result
中字段的结构:
字段 | 类型 | 说明 |
---|---|---|
card_number | string | 银行卡卡号 |
valid_from | string | 有效期起期 格式yy/mm |
valid_thru | string | 有效期止期 格式yy/mm |
bank_name | string | 发卡行名称 |
bank_identification_number | string | 发卡行标识代码 |
card_name | string | 卡片名称 |
card_type | string | 卡片类型 |
{
"request_id": "xxxxxxxxxxxxx",
"status": "OK",
"time_cost": 0.2,
"result": {
"card_number": "62179********856410"
"valid_from": "18/05",
"valid_thru": "28/05",
"bank_name":" 中国银行",
"bank_identification_number":"1040000",
"card_name":"借记IC联名卡",
"card_type":"借记卡"
}
}
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",
}