The HRPro Web Service API for Attendance File Bulk Import enables developers to upload bulk attendance files (text, Excel, or XLS formats) directly to HRPro for processing and updating attendance records.
This API supports multiple predefined attendance import formats defined in HRPro, allowing integration with external systems for automated batch imports.
After enabling the API, use it to submit files via HTTP POST for real-time or scheduled attendance updates.
POST /api/AttendanceImportApi
This endpoint accepts multipart/form-data uploads of attendance files and processes them according to the specified format, optionally deleting prior period data before import.
Upload a file with the following form fields:
200 OK: "Import successful" on completion.
400 Bad Request: Errors like "Database required", "402 Password not correct", "401 No right to access Attendance Import", "Attendance Import Web API disabled", or processing failures.
500 Internal Server Error: Exceptions during processing.
The database to update is the data source defined in HRPro.config if the Database property is not provided.
Define enableAttendanceImportWebAPI to true in HRPro.config.
Contact your HRPro Authorized Solution Provider to obtain your developerID.
Supports languages like C#, VB.NET, PHP, Python, cURL, and PowerShell.
# Set your variables
$ApiUrl = "http://your-hrpro-server/api/AttendanceImportApi"
$Database = "dbABCCom"
$DeveloperID = "your-dev-id"
$UserID = "admin"
$Password = "pass123"
$Format = "1" # AttendanceImportFormat
$Period = "2026/01"
$DeleteFirst = "true" # DeletePeriodDataFirst
$FilePath = "C:\path\to\attendance.xlsx" # Full path to your file
# Make the request
try {
$form = @{
Database = $Database
DeveloperID = $DeveloperID
UserID = $UserID
Password = $Password
AttendanceImportFormat = $Format
Period = $Period
DeletePeriodDataFirst = $DeleteFirst
file = Get-Item -Path $FilePath
}
$response = Invoke-WebRequest -Uri $ApiUrl -Method Post -Form $form
# Output status and response body
Write-Host "Status: $($response.StatusCode)"
Write-Host "Result: $($response.Content)"
}
catch {
Write-Error "Request failed: $($_.Exception.Message)"
Write-Error "Response body: $($_.Exception.Response.Content)"
}
Save your PowerShell script as a .ps1 file, for example: C:\HRProScripts\ImportAttendance.ps1
Test it manually in PowerShell as Administrator to confirm it works:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
& "C:\HRProScripts\ImportAttendance.ps1"
The steps below show how to create a scheduled task to run this PowerShell script unattended.