1. 文档上传
1.1. 调用地址
https://api.regenai.com/v1/document/upload
1.2. 请求方式
POST
1.3. 请求数据类型
multipart/form-data
1.4. 返回类型
JSON
1.5. 请求参数
名称 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
Key | app_key | true | String | c5ed72329fece2fe0010a437505b01cb | 分配的key |
令牌 | token | true | String | 7007bd1257dce8d47489166a7c77a926 | 授权令牌 |
时间戳 | timestamp | true | String | 1522374165 | timestamp 为January 1 1970 00:00:00 GMT 到现在的秒数 |
文件 | file_list | false | Binary | 文件 | |
文件链接 | file_url_list | false | List<span><String | http://t.cn/EbhjOOq | 文件链接地址 |
文件Base64数据 | file_data_list | false | List<span><String | 文件Base64数据 | |
文件名称 | file_name | false | String | 指定文件名称 | |
命名空间 | name_space | false | String | 同一个用户下区分使用不同的使用者 | |
语言 | language | false | String | chs | 默认chs chs-简体中文 cht-繁体中文 eng-英语 jpn-日语 kor-韩语 vie-越南语 tha-泰语 spa-西班牙语 deu-德语 fra-法语 rus-俄语 nld-荷兰语 ita-意大利语 por-葡萄牙语 msa-马来语 ind-印尼语 |
1.5.1. 请求说明
- 支持的图片类型: jpg, jpeg, png及pdf, pdf格式文件只支持单个上传,文件最大支持50M. 文档文件建议页数在200页以内
- token 的值计算方式为:
md5($appkey+$timestamp+$appSecret)
token=md5("c5ed72329fece2fe0010a437505b01cb+1522374165+5c9597f3c8245907ea71a89d9d39d08e")=7007bd1257dce8d47489166a7c77a926
- 生成token时,字符串连接中的“+”是必需的,缺少这个符号会无法验证通过验证
1.6. 返回值
1.6.1. 正确返回参数
名称 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
返回状态码 | result | true | int | 0或1 | 请求状态. 1:成功, 0:失败 |
回复 | response | true | json |
1.6.2. 正确返回样例
{
"result": 1,
"message": "success",
"response": {
"data": {
"uid": "3419e49758xxxx",
"name": "xxx.pdf",
"status": "PENDING", // PENDING:等待处理, PROGRESS:处理中, SUCCESS:处理成功, FAILED:处理失败 , EXCEEDED:过期
"page_count": 0
}
}
}
2. 获取还原结果
2.1. 调用地址
https://api.regenai.com/v1/document/result
2.2. 请求方式
POST
2.3. 请求数据类型
multipart/form-data 或 application/x-www-form-urlencoded
2.4. 返回类型
JSON
2.5. 请求参数
名称 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
Key | app_key | true | String | c5ed72329fece2fe0010a437505b01cb | 分配的key |
令牌 | token | true | String | 7007bd1257dce8d47489166a7c77a926 | 授权令牌 |
时间戳 | timestamp | true | String | 1522374165 | timestamp 为January 1 1970 00:00:00 GMT 到现在的秒数 |
文档标识 | document_uid | true | String | 5d24522e1daf4aa7a47b01da46ea6105 | 文档UID |
命名空间 | name_space | false | String | 命名空间 | |
输出格式 | out_type | false | int | 0 | 0 默认:打印体,手写体,表格,图片分开输出。 1:打印体,手写体,表格,图片合并到一个结构按阅读顺序输出 |
2.6. 返回值
2.6.1. 正确返回参数
名称 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
返回状态码 | result | true | int | 0或1 | 请求状态. 1:成功, 0:失败 |
回复 | response | true | json |
2.6.2. 正确返回样例
{
"result": 1,
"message": "success",
"response": {
"data": {
"identify_results": [
{
"details": {
// 页面中的图片信息
"images":[
{
"region":[
797,
58,
911,
58,
911,
85,
797,
85
]
}
],
// 页面中的表格信息
"tables": [
{
"cells": [
{
"endcol": 3,
"endrow": 1,
"lines": [
{
"text": "期末金额"
}
],
"region": [
588,
119,
714,
119,
714,
134,
588,
134
],
"startcol": 2,
"startrow": 0,
"text_rects": [
[
{
"confidence": 0.9952,
"raw_text": "期末金额",
"region": [
626,
119,
675,
119,
675,
134,
626,
134
]
}
]
]
}
],
"col_num": 8,
"region": [
250,
120,
1462,
121,
1461,
1091,
249,
1090
],
"row_num": 66
}
],
// 打印字体信息
"print": [
{
"confidence": 0.999,
"region": [
797,
58,
911,
58,
911,
85,
797,
85
],
"result": "资产",
"words": [
{
"confidence": 0.999,
"region": [
800,
58,
824,
58,
824,
85,
800,
85
],
"result": "资"
},
{
"confidence": 0.999,
"region": [
824,
58,
846,
58,
846,
85,
824,
85
],
"result": "产"
},
]
}
],
// 手写信息
"handwritten": [
{
"confidence": 0.99,
"region":[0,1,2,3,4,5,6,7],
"result":"手写结果"
"words":[
{
"confidence": 0.999,
"region":[0,1,2,3,4,5,6,7],
"result":"手"
}
]
}
]
},
"orientation": 270,
"page": 2,
"region": [
0,
0,
1685,
1191
]
}
],
}
},
}
3. 导出还原结果
3.1. 调用地址
https://api.regenai.com/v1/document/export
3.2. 请求方式
POST
3.3. 请求数据类型
multipart/form-data 或 application/x-www-form-urlencoded
3.4. 返回类型
- PDF文件:application/pdf
- Word文件:application/vnd.openxmlformats-officedocument.wordprocessingml.document
- Ofd文件:application/octet-stream
3.5. 请求参数
名称 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
Key | app_key | true | String | c5ed72329fece2fe0010a437505b01cb | 分配的key |
令牌 | token | true | String | 7007bd1257dce8d47489166a7c77a926 | 授权令牌 |
时间戳 | timestamp | true | String | 1522374165 | timestamp 为January 1 1970 00:00:00 GMT 到现在的秒数 |
文档标识 | document_uid | true | String | 5d24522e1daf4aa7a47b01da46ea6105 | 文档UID |
命名空间 | name_space | false | String | 命名空间 | |
导出格式 | export_type | false | String | 导出格式(pdf/word/ofd) | |
忽略插图文字 | ignore_image_words | false | int | 默认是0:不忽略, 1:忽略 |
3.6. 返回值
文件流