Purpose

This API allows you to manually add or modify punch logs for a user.
It is typically used in time & attendance integrations or for correcting records post-event.



How It Works in BioStar 2

Search for TA punch logs. Click on them to add/edit punch logs.  


You can click the ‘Add’ button to add a new modified punch log. 

You can click the pencil icon to modify an existing punch log.

In order to add a new modified punch log, you must insert the 'Punch Time' and 'Punch Type'.

텍스트, 스크린샷, 실내, 모니터이(가) 표시된 사진

자동 생성된 설명

텍스트, 스크린샷, 실내이(가) 표시된 사진

자동 생성된 설명



How to Do This via API 

Step 1. Search for punch logs 


API Endpoint:

POST /tna/punch_logs/modified

Body Parameters: 

Name

Type

Required

Description

Date

String

Y

Date of the log that holds the punch logs

Format: YYYY-MM-DD

Day_start_time

Long

Y

Day start time used for searching punch logs in minutes using 24-hour clock

Ex: '60', '480'

Retrieve_only_modified

Boolean

N

Indicates if only modified records should be retrieved.

If false is entered, modified records and device records are retrieved. In this case, the result may be higher than the limit value. 

User_id

String

N

User ID of the logs

if you want to search for all users, do not add this parameter in the request body 

limit

Number

N

Number of logs
Max: 5000

Added in v2.9.9

offset

Number

N

Offset

Added in v2.9.9 


* For "user_id" parameter, 

- if you want to search for a specific user, input the id of the user 

       ex) "user_id": "1"

- if you want to search for a list of users, input an array of IDs of the users

      ex) "user_id" : ["1"," 2"]

- if you want to search for all users, do not add "user_id" parameter in the request body 



Request Example

{
       "date": "2022-04-06",
       "day_start_time": 0,
       "retrieve_only_modified": true,
       "user_id": "1"
}

 

Response Example

{
    "message": "Processed Successfully",
       "message_key": "SUCCESSFUL",
    "language": "en",
       "status_code": "SUCCESSFUL",
    "total": 3,
    "records": [
        {
               "modified_log": {
                   "id": 7,
                "device_datetime": "2022-04-06 08:00:00",
                "type": "PUNCH_TYPE_CHECK_IN",
                   "user": {
                       "user_id": "1",
                       "name": "Administrator"
                },
                   "device_datetime_format_string": "2022/04/06 08:00:00"
            },
            "device_datetime": "2022-04-05T23:00:00.000Z",
               "device_datetime_long": 1649199600000,
               "type": "PUNCH_TYPE_CHECK_IN",
               "modified_by_user": {
                   "user_id": "1",
                   "name": "Administrator"
            }
        },
        {
               "modified_log": {
                   "id": 9,
                "device_datetime": "2022-04-06 12:00:00",
                "type": "PUNCH_TYPE_BREAK_START",
                "user": {
                       "user_id": "1",
                       "name": "Administrator"
                },
                   "device_datetime_format_string": "2022/04/06 12:00:00"
            },
               "device_datetime": "2022-04-06T03:00:00.000Z",
            "device_datetime_long": 1649214000000,
               "type": "PUNCH_TYPE_BREAK_START",
               "modified_by_user": {
                   "user_id": "1",
                   "name": "Administrator"
            }
        },
        {
               "modified_log": {
                   "id": 8,
                "device_datetime": "2022-04-06 17:00:00",
                "type": "PUNCH_TYPE_CHECK_OUT",
                   "user": {
                       "user_id": "1",
                       "name": "Administrator"
                },
                   "device_datetime_format_string": "2022/04/06 17:00:00"
            },
               "device_datetime": "2022-04-06T08:00:00.000Z",
               "device_datetime_long": 1649232000000,
               "type": "PUNCH_TYPE_CHECK_OUT",
               "modified_by_user": {
                   "user_id": "1",
                   "name": "Administrator"
            }
        }
    ]
}

 

The above response obtained from API represents the same results as the screenshot below seen on BioStar 2 Web UI. 

 

 

Step 2. Add New Modified Punch Logs 


API Endpoint:

PUT /tna/punch_logs/modified

Body Parameters:

Name

Type

Required

Description

Logs

Array

N

Already-existing logs

Logs.modified_log

Data

N

Already-existing modified logs

Logs.modified_log.id

String

N

Modified log’s ID

Logs.modified_log.device_datetime

Datetime

N

Modified log’s device time

Logs.modified_log.type

String

N

Modified logs’ punch type code

Logs.modified_log.user.user_id

String

N

User’s ID

Logs.modified_log.user.name

String

N

User’s Name

Logs.modified_logdevice_datetime_format_string

String

N

Modified log’s device datetime in string format

 

 

 

Logs.original_log

Data

N

 

Logs.modified_log

Data

N

New modified log information

Logs.modified_log.device

Data

N

New modified log’s device

Logs.modified_log.user.user_id

String

N

New modified log’s user ID

Logs.modified_log.formatted_type.code

String

N

New modified log’s punch type code

Logs.modified_log.formatted_type.id

String

N

New modified log’s punch type code

Logs.modified_log.formatted_type.description

String

N

New modified log’s punch type code description

Logs.modified_log.formatted_datetime

Datetime

N

New modified log’s datetime

Logs.modified_log.device_datetime

Datetime

N

New modified log’s device datetime

Logs.modified_log.device_datetime_format_string

Datetime

N

New modified log’s device datetime format string

Logs.modified_log.type

String

N

New modified log’s punch type 

 

 

 


* Not all the parameters are listed. Please check out the response body below.


Request Example

{
       "logs": [
           {
               "modified_log": {
                "id": 7,
                "device_datetime": "2022-04-06 08:00:00",
                "type": "PUNCH_TYPE_CHECK_IN",
                "user": {
                    "user_id": "1",
                    "name": "Administrator"
                },
                "device_datetime_format_string": "2022/04/06 08:00:00"
            },
            "device_datetime": "2022-04-05T23:00:00.000Z",
            "device_datetime_long": 1649199600000,
            "type": "PUNCH_TYPE_CHECK_IN",
            "modified_by_user": {
                "user_id": "1",
                "name": "Administrator"
            },
            "rowEditable": false
        },
           {
               "modified_log": {
                "id": 9,
                "device_datetime": "2022-04-06 12:00:00",
                "type": "PUNCH_TYPE_BREAK_START",
                "user": {
                    "user_id": "1",
                    "name": "Administrator"
                },
                   "device_datetime_format_string": "2022/04/06 12:00:00"
               },
               "device_datetime": "2022-04-06T03:00:00.000Z",
               "device_datetime_long": 1649214000000,
               "type": "PUNCH_TYPE_BREAK_START",
               "modified_by_user": {
                "user_id": "1",
                "name": "Administrator"
               },
               "rowEditable": false
           },
           {
               "modified_log": {
                "id": 8,
                "device_datetime": "2022-04-06 17:00:00",
                "type": "PUNCH_TYPE_CHECK_OUT",
                "user": {
                    "user_id": "1",
                    "name": "Administrator"
                },
                "device_datetime_format_string": "2022/04/06 17:00:00"
               },
               "device_datetime": "2022-04-06T08:00:00.000Z",
               "device_datetime_long": 1649232000000,
               "type": "PUNCH_TYPE_CHECK_OUT",
               "modified_by_user": {
                   "user_id": "1",
                "name": "Administrator"
               },
               "rowEditable": false
           },
           {
               "original_log": {},
            "modified_log": {
                "device": {},
                "user": {
                    "user_id": "1"
                },
                "formatted_type": {
                    "code": "PUNCH_TYPE_BREAK_END",
                    "id": "PUNCH_TYPE_BREAK_END",
                    "description": "Break End"
                },
                   "formatted_datetime": "2022-04-06 13:00:00",
                "device_datetime": "2022-04-06 13:00:00",
                   "device_datetime_format_string": "2022/04/06 05:00:00",
                "type": "PUNCH_TYPE_BREAK_END"
            },
            "rowEditable": true
           }
    ],
       "user_id": "1"
}

 

Response Example

{
    "message": "Processed Successfully",
       "message_key": "SUCCESSFUL",
    "language": "en",
       "status_code": "SUCCESSFUL"
}

 

We have successfully added a new modified punch log via API. You can check via BioStar 2 Web UI that the new punch log has been added.


테이블이(가) 표시된 사진

자동 생성된 설명

 

 

Before You Go

  

You can find the APIs in this article in our TA Swagger Page as well. 

 

New to Swagger or our TA API?  

Check out the following guide to learn the basics of using the TA API and how to get started with Swagger, where you can explore all available TA API endpoints and test them interactively. 

[BioStar 2 TA API] Introduction to BioStar 2 TA API