Check-In Simulator
Simulating checking-in or a checking-out event as though it is done through a device, a terminal, or a smartphone. The event data will be pushed to an endpoint to be processed as a simulated data.
This simulator is meant to be used during system integration development. It applies the same protocol as the real system.
Protocol
- Communication with the endpoint is based on HTTPS protocol with bearer authentication scheme. Hence, the endpoint owner must provide the bearer token.
The push is done with a post request. The payload is in JSON format:
{ "authenticator": "", "gps_location": "", "triggered_at": "", "person_id": "", "person_name": "", "person_action": "", "person_face_image": "" }authenticator
A simulated authenticator such as a device id, or a terminal id. It can be a real one.
gps_location
A simulated GPS location in decimal format. Example:
41.40338, 2.17403
triggered_at
A simulated timestamp in the standard ISO 8601 date and time format including time zone. Example:
2026-08-03T13:52:47+08:00
person_id
A simulated person id.
person_name
A simulated person name.
person_action
A simulated person action. It can be
"check-in", "check-out" or "undefined".person_face_image
A simulated person face JPEG image in Base64 (RFC 4648) encoding.
- The endpoint must response with "OK". A real system will keep on pushing with the same data until it receives an OK response. All other responses are ignored. This is a master-slave protocol for a real-time system. Hence, the handshake is kept to the minimum.
Endpoint Example
This simulator was built using Rust. The enpoint example code below is PHP. It shows that the protocol is not language dependent.
<?php
$bearer_token = 'RjmFa2Sv4a8dPuHyKTfmYEKWlHeLeGi7eDITatKa8af831f5';
// 1. Get all request headers
$headers = getallheaders();
// 2. Check if Authorization header exists
foreach ($headers as $key => $value) {
if (strtolower($key) === 'authorization') {
// Keep the 'Bearer' keyword lower case
$authHeader = str_replace("BEARER", "bearer", $value);
$authHeader = str_replace("Bearer", "bearer", $authHeader);
break;
}
}
if (!isset($authHeader)) {
http_response_code(401);
echo 'Authorization header missing';
exit();
}
// 3. Extract token from "Bearer {token}"
if (preg_match('/bearer\s+(.*)$/i', $authHeader, $matches)) {
$token = $matches[1];
// Validate the token
if ($token === $bearer_token) {
// 4. Process the payload
$rawBody = file_get_contents('php://input');
file_put_contents('checkin.json', $rawBody);
// Extract the base64 person face image and convert it to binary...
$json = json_decode($rawBody, true);
$image_binary = base64_decode($json['person_face_image']);
// ...and save it as an image file
file_put_contents('image.jpg', $image_binary);
// Respond with 'Ok'
echo 'Ok';
} else {
http_response_code(403);
echo 'Invalid token';
}
} else {
http_response_code(400);
echo 'Invalid Authorization format';
}
?>