Skip to main content
GET
/
attendance
/
all
curl -X GET "https://your-server:5000/attendance/all"
{
  "success": true,
  "total": 3,
  "errors": {},
  "data": [
    {
      "user_id": "5",
      "timestamp": "2026-03-06 09:15:23",
      "status": 1,
      "punch": 0,
      "device_id": "principal",
      "device_name": "Entrada Principal"
    },
    {
      "user_id": "12",
      "timestamp": "2026-03-06 08:45:12",
      "status": 1,
      "punch": 0,
      "device_id": "bodega",
      "device_name": "Bodega Principal"
    },
    {
      "user_id": "5",
      "timestamp": "2026-03-05 17:30:45",
      "status": 0,
      "punch": 1,
      "device_id": "principal",
      "device_name": "Entrada Principal"
    }
  ]
}
Fetch attendance records from all registered devices in parallel. This endpoint uses threading to query multiple devices concurrently and aggregates the results.

Query Parameters

user_id
string
Filter attendance records by a specific user ID. Only records matching this exact user ID will be returned.
date
string
Filter attendance records by date in YYYY-MM-DD format (e.g., 2026-03-03). Only records where the timestamp starts with this date will be returned.

Response Format

The response includes aggregated attendance records from all devices, along with any errors encountered during device queries.

Response Fields

success
boolean
required
Indicates whether the operation completed successfully.
total
integer
required
Total number of attendance records returned across all devices.
errors
object
required
Map of device IDs to error messages for any devices that failed to respond. Empty if all devices responded successfully.
data
array
required
Array of attendance records sorted by timestamp in descending order (newest first).

Threading and Concurrency

This endpoint uses Python threading to query all devices in parallel for optimal performance:
  • Each device is queried in its own thread
  • Device-level locks prevent concurrent access to the same device
  • A result lock ensures thread-safe aggregation of results
  • The device is temporarily disabled during data retrieval
  • All threads must complete before the response is returned
If any device fails, its error is captured in the errors object, but the endpoint still returns successfully with data from other devices.
curl -X GET "https://your-server:5000/attendance/all"
{
  "success": true,
  "total": 3,
  "errors": {},
  "data": [
    {
      "user_id": "5",
      "timestamp": "2026-03-06 09:15:23",
      "status": 1,
      "punch": 0,
      "device_id": "principal",
      "device_name": "Entrada Principal"
    },
    {
      "user_id": "12",
      "timestamp": "2026-03-06 08:45:12",
      "status": 1,
      "punch": 0,
      "device_id": "bodega",
      "device_name": "Bodega Principal"
    },
    {
      "user_id": "5",
      "timestamp": "2026-03-05 17:30:45",
      "status": 0,
      "punch": 1,
      "device_id": "principal",
      "device_name": "Entrada Principal"
    }
  ]
}

Notes

  • The endpoint queries all registered devices in the system
  • Results are sorted by timestamp in descending order (newest first)
  • Filters are applied after fetching data from devices (server-side filtering)
  • The device is temporarily disabled during query to prevent interference
  • Each device uses its own lock to prevent concurrent access
  • Failed device queries don’t cause the entire request to fail

Build docs developers (and LLMs) love