Purpose

This API allows you to search punch logs.


How It Works in BioStar 2

You can search for you TA punch logs as seen below. 

 

How to Do This via API 

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. You can verify that the data is equal. 

 


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