HTTP API
BlinkEasy provides a simple way to integrate with your own applications. For example, you can create custom analytics or control IoT devices, such as adjusting lighting based on blink rate.
Enable this advanced feature by specifying a callback URL on the settings page. See the ESP32 code sample.
- To ensure privacy, the HTTP Module is limited to generalized data and cannot send video frames or personally identifiable information.
- Requests are sent instantly when events occur and periodically to report statistics, such as the current blink rate.
- Custom parameters are supported to include credentials or differentiate between devices.
Parameters sent with every request:
| event | ID of the event. Possible values: BLINK, START, END, BPM, ALERT, BREAK |
| timestamp | Milliseconds elapsed since January 1, 1970 (UTC). |
Example:
http://localhost:3000/myscript.php?event=START×tamp=1723321032811
Possible events:
BLINK
Sent when a blink is detected.
Parameters:
| duration | Blink duration in milliseconds |
| bpm | Current blink rate (blinks per minute) |
Example:
http://localhost:3000/myscript.php?event=BLINK&bpm=13.2&duration=185×tamp=1723321032811
START
Sent when a face is detected for the first time, starting the session.
Example:
http://localhost:3000/myscript.php?event=START×tamp=1723321032811
END
Sent when no face has been detected for timeout milliseconds, ending the current session.
Parameters:
| timeout | Current session timeout in milliseconds. The last time a face was recognized is the event's timestamp minus the timeout. |
Example:
http://localhost:3000/myscript.php?event=END&timeout=60×tamp=1723321032811
BPM
Periodic event
Parameters:
| bpm | Current blink rate in blinks per minute. |
Example:
http://localhost:3000/myscript.php?event=BPM&bpm=13.2×tamp=1723321032811
ALERT
Sent when the user's blink rate falls below the given threshold. This event is also sent when blink reminders are disabled.
Parameters:
| bpm | Current blink rate in blinks per minute. |
| target | The threshold that the current blink rate has fallen below. |
| duration | Number of milliseconds below the target until the alert was issued. |
Example:
http://localhost:3000/myscript.php?event=ALERT&bpm=13.2&target=15.0&duration=12×tamp=1723321032811
BREAK
A break reminder was issued.
Parameters:
none
Example:
http://localhost:3000/myscript.php?event=BREAK×tamp=1723321032811