Create Person
https://api.apptenticate.com/api/v2/biometrics/recognizer/persons/
This request allows you to create a Person within the project assigned for the Recognizer service
Request data
To create a person, the service needs the following parameters in the body of the request:
| Field | Type | Description |
|---|---|---|
| citizen_id | string | Identity card or some unique identifier of the person |
| name | string | Person's name |
| image | file | Person's selfie image. Any valid image format. Less than 2MB |
Request example
- Shell
- Node
- Python
Request
curl --location 'https://api.apptenticate.com/api/v2/biometrics/recognizer/persons/' \
--header 'Authorization: Bearer <jwt_token>' \
--form 'citizen_id="<cédula>"' \
--form 'name="<nombre>"' \
--form 'image=@"<ruta_archivo>"' \
Instalación
npm install axios form-data
Request
const axios = require('axios')
const FormData = require('form-data')
const fs = require('fs')
let data = new FormData()
data.append('citizen_id', '<cédula>')
data.append('name', '<nombre>')
data.append('image', fs.createReadStream('<ruta_archivo>'))
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.apptenticate.com/api/v2/biometrics/recognizer/persons/',
headers: {
Authorization: 'Bearer <jwt_token>',
...data.getHeaders()
},
data: data
}
axios
.request(config)
.then((response) => {
console.log(JSON.stringify(response.data))
})
.catch((error) => {
console.log(error)
})
Instalación
python -m pip install requests
Request
import requests
url = "https://api.apptenticate.com/api/v2/biometrics/recognizer/persons/"
payload = {'citizen_id': '<cédula>',
'name': '<nombre>'}
files=[
('image',('<nombre_archivo>',open('<ruta_archivo>','rb'),'image/jpeg'))
]
headers = {
'Authorization': 'Bearer <jwt_token>'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
Response data
If the person is created successfully, the service will return a JSON object with the following structure:
| Field | Type | Description |
|---|---|---|
| id | file | Unique identifier within Recognizer, this is the one that allows you to update or delete the person |
| citizen_id | string | Identity card or some unique identifier of the person |
| name | string | Person's name |
| image | string | Person's image URL |
| is_blocked | bool | Indicates whether the person is blocked or not |
| created_at | string | Person's creation date |
| agreed_terms | bool | Indicates if the person accepted the Recognizer service terms and conditions |
Example of successful response
status_code: 201
{
"id": 47662684,
"citizen_id": "<identity card>",
"name": "<name>",
"image": "<image_url>",
"is_blocked": false,
"created_at": "2023-11-13T10:20:46.865685-05:00",
"agreed_terms": false
}
Example of response with rejection
status_code: 400
{
"error": "There is already a registered person with that ID",
"error_code": 903
}
Rejection codes
If the request is not successful, a rejection code will be sent in the response. Possible rejection codes are:
| Code | Message |
|---|---|
901 | Image too large. Maximum size allowed: 2MB |
902 | There is no person registered with that identification |
903 | There is already a person registered with that ID |
904 | No faces detected in the image |
905 | More than one face detected, only images with one face are allowed |