Affected Version: BioStar 2.8.17, BioStar 2.9 or higher version
Time Attendance API [POST] /punch_log has been improved with BioStar 2.8.17.
For ‘How to use TA API swagger’, please refer to the link below:
[BioStar 2 TA API] How to use and start BioStar 2 TA API
Background
It allows for creating punch logs via API at mobile environments and more and to record the device information to the environment (i.e., mobile).
The previous API did not have a feature allowing users to set ‘devnm’ as custom.
Requirements
The user should be able to set the device name(devnm) as custom(string) when using TA punch_logs API.
The improvement was made to prevent punch logs created by the above API from being deleted when forced to synchronize.
<Created Punch log in TA Report>
How to create punch logs via using TA API
[POST] /punch_logs API creates a punch log with the device information.
Before using any TA API, you must log in with the TA API login feature. Once you log in, your login information will be used for all other TA API features. This /punch_log API will do the same.
The logged-in information will be used for the /punch_log API, and the punch logs created will be the punch logs of the logged-in user.
You can find the /tna/Punch Log API in your TA Swagger.
Part 1. Create punch logs
[POST]: /tna/punch_logs
[Headers]
*offset & limit headers are required.
[Parameters]
Name | Type | *M/O | Explanation | Value |
Device_date_time | String | O | Datetime of the punch log *If this value is not used, current time value will be used for the punch log | Yyyy-mm-dd hh:mm:ss |
Device_id | String | O | Device ID of the punch log |
|
Device_name | String | M | Device Name of the punch log |
|
Type | String | M | 'PUNCH_TYPE_NONE' or 'PUNCH_TYPE_CHECK_IN' or 'PUNCH_TYPE_CHECK_OUT' or 'PUNCH_TYPE_BREAK_START' or 'PUNCH_TYPE_BREAK_END' or 'PUNCH_TYPE_MEAL_START' or 'PUNCH_TYPE_MEAL_END' |
|
* M – Mandatory, O – Optional
[Example Value/Parameters Model]
{ "device_date_time": "2022-08-17 21:22:22", "device_id": "547835888", "device_name": "FaceStation F2 547835888 (192.168.116.159)", "type": "PUNCH_TYPE_CHECK_IN" } |
[Response: successful]
{ "message": "Created successfully", "message_key": "CREATED", "language": "en", "status_code": "CREATED" } |
The above response represents the results same as the screenshot below.
<Created Punch log in TA Report>
Part 2. Create punch logs via POSTMAN
<Running POST /punch_log API on Postman>
Part 3. Create punch logs with CURRENT DATETIME
When TA API /punch_log is used without ‘Device_date_time’ value, the punch log will be made with the CURRENT DATETIME value..
[Example Value/Parameters Model]
{ "device_id": "547835888", "device_name": "FaceStation F2 547835888 (192.168.116.159)", "type": "PUNCH_TYPE_CHECK_IN" } |
[Response: successful]
{ "message": "Created successfully", "message_key": "CREATED", "language": "en", "status_code": "CREATED" } |
<Running POST /punch_log API without 'Device_date_time' on Postman>
<System's Current DateTime value was used for the punchlog>