API Documentation

Central Server REST API Reference
Overview

The Fingerprint Central Server provides a REST API for terminal registration, peer discovery, and synchronization management.

Base URL: http://localhost:8090

Authentication

Most endpoints require an API key obtained during terminal registration. Include it in the request header:

X-Terminal-Api-Key: tk-abc123...

The /register endpoint does not require authentication.

Terminal Registry
POST /api/terminals/register

Register a new terminal with the central server. Returns an API key for subsequent requests.

Request Body:

{
  "terminalId": "terminal-campus-a-01",
  "name": "Salle B - Poste 3",
  "ip": "192.168.1.101",
  "port": 8080,
  "campusId": 1,
  "campusName": "Campus A"
}

Response:

{
  "terminalId": "terminal-campus-a-01",
  "apiKey": "tk-abc123...",
  "name": "Salle B - Poste 3",
  "campusId": 1,
  "campusName": "Campus A",
  "registeredAt": "2026-04-13T10:30:00",
  "message": "Terminal registered successfully"
}
GET /api/terminals/peers

Get all active terminals on the same campus. Requires X-Terminal-Api-Key header.

Response:

[
  {
    "terminalId": "terminal-campus-a-02",
    "name": "Salle A - Poste 1",
    "ip": "192.168.1.102",
    "port": 8080,
    "campusId": 1,
    "campusName": "Campus A",
    "online": true,
    "lastHeartbeat": "2026-04-13T10:29:45"
  }
]
POST /api/terminals/heartbeat

Send a heartbeat to indicate the terminal is online. Requires X-Terminal-Api-Key header.

Request Body (optional):

{
  "syncMode": "FULL_SYNC"
}

Response:

{
  "status": "ok",
  "terminalId": "terminal-campus-a-01",
  "timestamp": 1713006000000
}
GET /api/terminals

List all registered terminals (admin endpoint, no auth required).

Response:

[
  {
    "terminalId": "terminal-campus-a-01",
    "name": "Salle B - Poste 3",
    "ip": "192.168.1.101",
    "port": 8080,
    "campusId": 1,
    "campusName": "Campus A",
    "online": true,
    "lastHeartbeat": "2026-04-13T10:30:00"
  }
]
DELETE /api/terminals/{terminalId}

Deactivate a terminal (admin endpoint).

Health Checks
GET /api/health/rabbit

Check RabbitMQ connection status.

Response:

{
  "status": "UP",
  "message": "RabbitMQ connection successful"
}
GET /api/health

General health check for the central server.

Response:

{
  "status": "UP",
  "timestamp": 1713006000000,
  "service": "fingerprint-central",
  "version": "1.0.0"
}
Error Codes
Code Description
200 Success
400 Bad Request - Invalid request body or parameters
401 Unauthorized - Invalid or missing API key
404 Not Found - Resource does not exist
500 Internal Server Error
503 Service Unavailable - Infrastructure component down