Leave Time Resource
The following requests are supported for operations with leave records via actiTIME API:
Leave Record Properties
Leave record properties available via API:
Property | Description |
---|---|
userId | Unique identifier of the user who tracked leave time. |
leaveTypeId | Unique identifier of the leave type. |
time | Tracked time (in minutes). |
Required Permissions
Users’ leave time records that can be retrieved are defined by the authorized user’s permissions.
Permission | Available Users |
---|---|
Enter Time-Track | Authorized User Only |
Manage PTO & Sick Days Settings | All Users |
Manage Accounts & Permissions | All Users |
Modify & Approve Users’ Time-Track | Assigned Team |
Note that if a user has several permissions, available objects are summarized.
For example, a user with the ‘Enter Time-Track’ and ‘Modify & Approve Users’ Time-Track’ permissions can access leave time tracked by the user and the user’s assigned team.
Retrieve Users’ Leave Time
Use the following request to extract users’ leave time tracked by users:
GET/leavetime
Use another requests to retrieve work time tracked by users for tasks:
GET/timetrack
GET/timetrack/{userId}/{date}/{taskId}
The GET/leavetime request can be specified with several parameters:
Parameter | Description |
---|---|
userIds | If provided, only leave time of users with given IDs will be returned. If not provided, all available users’ leave time will be returned. |
leaveTypeIds | If provided, only leave time tracked for leave types with given IDs will be returned. If not provided, leave time tracked for all leave types in the system will be returned. |
dateFrom | Required parameter. Only leave time tracked after this date will be returned. |
dateTo | If provided, only leave time tracked before this date will be returned. If not provided, all leave time tracked from [dateFrom] to last tracked date (with leave time) will be returned. |
stopAfter | If provided, n leave time records will be returned (approximately). The maximum value is 1000. If not provided, the default value (1000) is applied. The numbers are approximate because all available leave time records for each day are returned. When the ‘stopAfter’ limit is reached on a specific day, all leave time logged by requested users for that day is shown. Leave time records for remaining days are not included in the response. |
includeReferenced | Additional data that can also be included in the response: – users properties; – departments properties; – time zone groups properties; – leave types properties. |
Example Request:
curl -X GET "<actiTIME URL>/api/v1/leavetime?userIds=1&leaveTypeIds=2%2C%203&dateFrom=2019-05-01&dateTo=2019-05-10&stopAfter=1000&includeReferenced=leaveTypes" -H "accept: application/json; charset=UTF-8" -u "username:password"
Example Response:
{ "dateFrom": "2019-05-01", "dateTo": "2019-05-10", "leaveTypes": { "3": { "id": 3, "name": "Vacation", "balance": "PTO", "rateFactor": 1, "archived": false } }, "data": [ { "userId": 1, "dayOffset": 5, "leaveTypeId": 3, "leaveTime": 480 }, { "userId": 1, "dayOffset": 6, "leaveTypeId": 3, "leaveTime": 480 }, { "userId": 1, "dayOffset": 7, "leaveTypeId": 3, "leaveTime": 480 }, { "userId": 1, "dayOffset": 8, "leaveTypeId": 3, "leaveTime": 480 }, { "userId": 1, "dayOffset": 9, "leaveTypeId": 3, "leaveTime": 480 } ] }
Note that:
1. Leave time dates are not provided directly in the response. Instead, the ‘dayOffset’ parameter is used. Leave Time Date = dateFrom + dayOffset.
2. If the number of leave time records to be returned is more than has been specified in the ‘stopAfter’ parameter, then the ‘nextDateFrom’ parameter is included in the response. Use the value of this parameter as the value for the ‘dateFrom’ parameter in the next request if you want to get all leave time records.
More info on using this request is available in our detailed documentation