1. Home
  2. Docs
  3. Documentation
  4. Personnel APIs – V1
  5. API: Import Attendance Logs

API: Import Attendance Logs

The purpose of this API is to upload attendance logs to modulus®.

Request

API Name PublicAttendanceLogImport
URL https://your_account.modulus.biz/api/hr/PublicAttendanceLogImport&token=YOUR_TOKEN
Method POST
Source Third Party Server
Recipient modulus® Server
Content Type multipart/form-data

Query String Parameters

Parameter Description
token Security token retrieved from Authentication API.

Request Body Parameters

Parameter Description
device_id The device ID retrieved from the API PublicAttendanceDeviceList.
log_file File in CSV format that holds attendance logs to be uploaded. File should be UTF-8 encoded without BOM.

The uploaded file must be structured as follows:

Employee ID Date Time Direction Flag
1 2018-01-01 10:00:00 I
1 2018-01-01 16:30:00 O

File is in CSV format with PIPE “|” separator, the above table should map to the following file content:

1 | 2018-01-01 10:00:00 | I
1 | 2018-01-01 16:30:00 | O
Notes
  • Possible direction flag values: ‘I’ for check-in, ‘O’ for check-out.
  • Note that, header row must not be included in the uploaded file.
  • The direction flag is necessary if the device setup on modulus® is marked to accept this flag (i.e. device direction set to “IN/OUT” value)
  • If the device direction is set to “IN”, modulus® accepts all logs as “check-in”, regardless of the direction flag.
  • If the device direction is set to “OUT”, modulus® accepts all logs as “check-out”, regardless of the direction flag.
  • If the device direction is set to “NONE”, modulus® decides direction of logs depending on the shifts on relevant date.
  • Log file size should not exceed 100KB. Larger log amounts should be split into smaller files of sizes less than 100KB.

Responses

HTTP Status result title message object
Success Responses
200 OK true Success Attendance logs imported successfully. null
Failure Responses
400 Bad Request false Bad Request Device ID is missing.
Logs file is missing.
Upload error #error_number
Uploaded file is larger than 100 KB.
Invalid file mime type.
Invalid file content.
Invalid Device ID.
Device is disabled.
null
500 Internal Server Error false Error Importing file failed. null

Example

Request
curl --request POST 'https://your_account.modulus.biz/api/cmn/PublicAttendanceLogImport?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--form 'device_id=13' \
--form 'log_file=@/D:/files/logs.csv'
Success Responses
200 OK
{
    "result": true,
    "title": "Success",
    "message": "Attendance logs imported successfully.",
    "object": null
}
Failure Responses
400 Bad Request
{
    "result": false,
    "title": "Bad Request",
    "message": "Device is disabled.",
    "object": null
}
500 Internal Server Error
{
    "result": false,
    "title": "Error",
    "message": "Importing file failed.",
    "object": null
}