SourceAfis API

API REST pour l'enrôlement, la vérification (1:1) et l'identification (1:N) d'empreintes digitales.

REST API JSON multipart/form-data

URL de base : /api

Enrôlement POST /api/fingerprints/enroll — enregistrer une empreinte
Vérification 1:1 POST /api/fingerprints/verify — comparer à une empreinte connue
Identification 1:N POST /api/fingerprints/identify — rechercher parmi tous les enregistrements

Tester avec Swagger

  1. Ouvrez /swagger.
  2. Les endpoints enroll, verify et identify acceptent multipart/form-data avec un champ fichier Image.
  3. Les endpoints citoyens utilisent du application/json.

Citoyens

Créer un citoyen

POST /api/citizens — application/json

{
  "firstName": "Jean",
  "lastName": "Dupont",
  "phone": "+33600000000"
}

Réponse 201 : { id, firstName, lastName, phone, createdAt }

Lister les citoyens

GET /api/citizens

Réponse 200 : tableau de citoyens.

Détail d'un citoyen

GET /api/citizens/{id}

Réponse 200 : détail du citoyen · 404 si introuvable.

EnrĂ´ler une empreinte

POST /api/fingerprints/enroll — multipart/form-data

ChampTypeDescription
CitizenIdlongIdentifiant du citoyen
FingerNamestringEx. RightThumb, LeftIndex
ImagefichierPNG, JPEG, BMP ou TIFF

Si une empreinte existe déjà pour le même citoyen et le même doigt, elle est remplacée par la nouvelle capture.

Réponse 200 :

{
  "fingerprintId": 1,
  "citizenId": 1,
  "fingerName": "RightThumb",
  "imagePath": "/uploads/fingerprints/xxx.png"
}

Vérifier une empreinte (1:1)

POST /api/fingerprints/verify — multipart/form-data

ChampTypeDescription
FingerprintIdlongEmpreinte enregistrée à comparer
ImagefichierNouvelle capture

Réponse 200 :

{
  "isMatch": true,
  "score": 52.3,
  "threshold": 40,
  "citizenId": 1,
  "fingerprintId": 1,
  "citizenName": "Jean Dupont",
  "matchCategory": "Match"
}

Identifier une empreinte (1:N)

POST /api/fingerprints/identify — multipart/form-data

ChampTypeDescription
ImagefichierEmpreinte Ă  identifier (obligatoire)
ThresholddoubleSeuil de correspondance (défaut : 40)

Réponse 200 : les 10 meilleurs candidats (même structure que verify), triés par score décroissant.

Empreintes d'un citoyen

GET /api/fingerprints/citizen/{citizenId}

Réponse 200 : liste des empreintes enregistrées pour ce citoyen.

Règles de score

ScoreRésultatmatchCategory
≥ 40MATCHMatch
25 – 39SUSPECT — validation humaineSuspect
< 25NON MATCHNoMatch

Récapitulatif des endpoints

MéthodeRouteFormatDescription
POST/api/citizensJSONCréer un citoyen
GET/api/citizens—Lister les citoyens
GET/api/citizens/{id}—Détail citoyen
POST/api/fingerprints/enrollmultipartEnrĂ´ler une empreinte
POST/api/fingerprints/verifymultipartVérification 1:1
POST/api/fingerprints/identifymultipartIdentification 1:N
GET/api/fingerprints/citizen/{id}—Empreintes d'un citoyen

Erreurs

Format : { "error": "message" }

  • 400 — image manquante, format invalide
  • 404 — citoyen ou empreinte introuvable