服务端 墨西哥v1协议文档
# v1协议文档 - 基于 multipart/form-data
## 文档修改说明
| 修改日志 | 改动人 | 改动时间 |
| -------- | ------ | ---------- |
| 1.0 初版 | aitime | 2022/12/06 |
### 1.使用须知
1.最新api版本v1版本
2.接⼝⽀持协议类型https
3.请求均为 POST请求
| 环境 | 后台管理地址 | 请求地址 |
| ---- | ----------------------------------------- | ----------------------------------------- |
| pord | https://mexico-min-shield.aitime.credit | https://mexico-api-shield.aitime.credit |
### 2.通用返回
所有接⼝的返回类型,⽤来封装错误码或返回数据。所有接⼝的结果都是下⾯的结构。
**返回参数**
| 参数名称 | 说明 | 类型 |
| :------- | :--------- | :----- |
| code | 业务码 | string |
| message | 业务码说明 | string |
| data | 业务数据 | object |
**返回码**
| code | Msg | 备注 |
| :------ | :---- | :--- |
| SUCCESS | OK | 成功 |
| FAIL | ERROR | 异常 |
### 3.通用请求头
| 参数 | 参考值 | 备注 |
| ----------- | ------------------------------------ | --------------- |
| X-ADVAI-KEY | 84b71eaf-72ec-4619-975b-b06fbd5786ed | aitime平台api调用唯一凭证 |
## 1. ocr认证
**接口地址**:`/api/shield-open/v1/ocr`
**请求方式**:`POST`
**请求数据类型**:`multipart/form-data`
**响应数据类型**:`*/*`
**接口描述**:
**请求头参数**:
| 参数名称 | 参数说明 | 数据类型 | 是否必须 |
| ----------- | ------------------- | -------- | -------- |
| X-ADVAI-KEY | 服务端openAccessKey | string | true |
**请求参数**:
| 参数名称 | 参数说明 | in | 数据类型 | 是否必须 |
| -------- | --------------------------------------- | -------- | -------- | -------- |
| cardType | Issue authority of the card(FRONT) | formData | string | true |
| country | country(MEXICO) | formData | string | true |
| image | image of the card | formData | file | true |
**响应参数**
| 参数名称 | 说明 | 类型 | schema |
| --------------- | ------------------------------------------------------------ | ------ | ------ |
| code | ID Card OCR Status Code | string | |
| data | | T | Json |
| extra | Extra response info (Exception Message) | string | |
| message | Status Code Explanation | string | |
| pricingStrategy | whether the request will be charged, enum type: `FREE`, `PAY` | string | |
| transactionId | the request id, the max length is 64 | string | |
**schema属性说明**
**Data-Json**
| 属性名称 | 说明 | 数据类型 | schema |
| ---------- | ------------- | -------- | ------ |
| cardSide | FRONT or BACK | string | |
| frontValue | positive data | T | |
| backValue | back data | T | |
**frontValue**
| 属性名称 | 说明 | 类型 | schema |
| -------- | ----------------------- | ---- | ------ |
| name | Name of the person |string | |
| birthday | Date of birth of the person | string | |
| idNumber | ID number of the person (CURP) | string | |
| gender | Gender of the person | string | |
| addressAll | Address detail information | string | |
| postalCode | Pin code in the address | string | |
**响应示例**:
<img src="https://chile-api-shield.aitime.credit/img/figure/mexico-2.png" style="zoom:50%;" />
```json
{
"code": "SUCCESS",
"data": {
"backValue": null,
"cardSide": "FRONT",
"frontValue": {
"addressAll": "C TAMAULIPAS 553 A FRACCSAN MIGUEL28985 VILLA DE ALVAREZ,COL",
"birthday": "16/07/1987",
"gender": "H",
"idNumber": "PERM870716HCMRJR00",
"name": "PEREZ ROJAS MARTIN OSWALDO",
"postalCode": "28985"
}
},
"extra": null,
"message": "OK",
"pricingStrategy": "PAY",
"transactionId": "361820183350981"
}
{
"code": "SUCCESS",
"data": {
"backValue": null,
"cardSide": "FRONT",
"frontValue": {
"addressAll": "C SINNOMBRE S/N PBLO LOSALGODONES21970 MEXICALI.B.C",
"birthday": "29/06/1982",
"gender": "M",
"idNumber": "RABL820629MBCNRR04",
"name": "RANGEL BERMUDEZ LAURA PAULA",
"postalCode": "21970"
}
},
"extra": null,
"message": "OK",
"pricingStrategy": "PAY",
"transactionId": "361819742748357"
}
```
## 2. 人脸比对-基于AiTime sdk
**接口地址**:`/api/shield-open/v1/face/living/check`
**请求方式**:`POST`
**请求数据类型**:`multipart/form-data`
**响应数据类型**:`*/*`
**接口描述**:
**请求头参数**:
| 参数名称 | 参数说明 | 数据类型 | 是否必须 |
| ----------- | ----------------------------- | -------- | -------- |
| X-ADVAI-KEY | 服务端openAccessKey(后台获取) | string | true |
**请求参数**:
| 参数名称 | 参数说明 | in | 是否必须 | 数据类型 | schema |
| -------- | ----------------- | -------- | -------- | -------- | ------ |
| country | country(MEXICO) | formData | true | string | |
| image | image | formData | true | file | |
| resource | Authentication resource id | formData | true | string | |
**响应参数**
| 参数名称 | 说明 | 类型 | schema |
| --------------- | ------------------------------------------------------------ | ------ | ------ |
| code | ID Card OCR Status Code | string | |
| data | | T | Json |
| extra | Extra response info (Exception Message) | string | |
| message | Status Code Explanation | string | |
| pricingStrategy | whether the request will be charged, enum type: `FREE`, `PAY` | string | |
| transactionId | the request id, the max length is 64 | string | |
**schema属性说明**
**data**
| 属性名称 | 说明 | 类型 | schema |
| ---------- | ------------------------------------------------------------ | ------ | ------ |
| similarity | Face similarity score, the recommended threshold is 80 points, such as 100, which means completely similar, and the value is between 0-100 | double | |
**响应示例**:
```json
{
"code": "SUCCESS",
"data": {
"firstFace": {
"bottom": 690.0,
"id": "1",
"left": 173.0,
"right": 339.0,
"top": 492.0
},
"secondFace": {
"bottom": 468.0,
"id": "2",
"left": 133.0,
"right": 335.0,
"top": 211.0
},
"similarity": 0.3
},
"extra": null,
"message": "OK",
"pricingStrategy": "FREE",
"transactionId": "350961988834309"
}
```
## 3. 人脸比对
**接口地址**:`/api/shield-open/v1/face-comparison`
**请求方式**:`POST`
**请求数据类型**:`multipart/form-data`
**响应数据类型**:`*/*`
**接口描述**:
**请求头参数**:
| 参数名称 | 参数说明 | 数据类型 | 是否必须 |
| ----------- | ------------------- | -------- | -------- |
| X-ADVAI-KEY | 服务端openAccessKey | string | true |
**请求参数**:
| 参数名称 | 参数说明 | in | 是否必须 | 数据类型 | schema |
| ----------- | ----------------- | -------- | -------- | -------- | ------ |
| country | country(MEXICO) | formData | true | string | |
| firstImage | Living photo | formData | true | file | |
| secondImage | Certificate photo | formData | true | file | |
**响应参数**
| 参数名称 | 说明 | 类型 | schema |
| --------------- | ------------------------------------------------------------ | ------ | ------ |
| code | ID Card OCR Status Code | string | |
| data | | T | Json |
| extra | Extra response info (Exception Message) | string | |
| message | Status Code Explanation | string | |
| pricingStrategy | whether the request will be charged, enum type: `FREE`, `PAY` | string | |
| transactionId | the request id, the max length is 64 | string | |
**schema属性说明**
| 属性名称 | 说明 | 类型 | schema |
| ---------- | ------------------------------------------------------------ | ------ | ------ |
| similarity | Face similarity score, the recommended threshold is 80 points, such as 100, which means completely similar, and the value is between 0-100 | double | |
**响应示例**:
```json
{
"code": "SUCCESS",
"data": {
"firstFace": {
"bottom": 690.0,
"id": "1",
"left": 173.0,
"right": 339.0,
"top": 492.0
},
"secondFace": {
"bottom": 468.0,
"id": "2",
"left": 133.0,
"right": 335.0,
"top": 211.0
},
"similarity": 0.3
},
"extra": null,
"message": "OK",
"pricingStrategy": "FREE",
"transactionId": "350961988834309"
}
```
## 4. 活体检验图片下载
**接口地址**:`/api/shield-open/v1/face/download`
**请求方式**:`POST`
**请求数据类型**:`multipart/form-data`
**响应数据类型**:`*/*`
**接口描述**:
**请求头参数**:
| 参数名称 | 参数说明 | 数据类型 | 是否必须 |
| ----------- | ------------------- | -------- | -------- |
| X-ADVAI-KEY | 服务端openAccessKey | string | true |
**请求参数**:
| 参数名称 | 参数说明 | in | 是否必须 | 数据类型 | schema |
| -------- | -------- | ----- | -------- | -------- | ------ |
| resource | Authentication resource id | query | true | string | |
**响应参数**:
文件流
**响应示例**:
```json
```
## 5. 查询活体人脸图片-base64
**接口地址**:`/api/shield-open/v1/face/img`
**请求方式**:`POST`
**请求数据类型**:`multipart/form-data`
**响应数据类型**:`*/*`
**接口描述**:
**请求头参数**:
| 参数名称 | 参数说明 | 数据类型 | 是否必须 |
| ----------- | ------------------- | -------- | -------- |
| X-ADVAI-KEY | 服务端openAccessKey | string | true |
**请求参数**:
| 参数名称 | 参数说明 | in | 是否必须 | 数据类型 | schema |
| -------- | -------- | -------- | -------- | -------- | ------ |
| resource | Authentication resource id | formData | true | string | |
**响应参数**
| 参数名称 | 说明 | 类型 | schema |
| -------- | ---- | ------ | ----------------- |
| data | | T | QueryFaceImagesVo |
| message | | string | |
| code | | string | |
**schema属性说明**
**QueryFaceImagesVo**
| 属性名称 | 说明 | 类型 | schema |
| --------- | ------------ | ------ | ------ |
| image | image | string | |
| imageType | Image type(BASE64) | string | |
**响应示例**:
```json
{
"code": "SUCCESS",
"data": {
"image":"data:image/jpeg;base64,xxxxxxx",
"imageType":"BASE64"
},
"message": "OK"
}
```