getUserLeaveTypes
Background
This API is used to get leave types of the user whose accountId is passed in the endpoint. When passed the account ID, this API will return the leave types and their remaining balance for the user (whose account ID is passed) based on applicable leave types that they can request leave for from the leave request popup on UI.
API Details
Since the API works based on User level API token, the response will also be user-specific based on what leave type they can view while requesting a leave.
Request
App name | Endpoint |
---|---|
UpRaise People | https://people.upraise.io/rest/upraise/public/1.0/leave/getUserLeaveTypes/{accountId} |
UpRaise Employee Garrison | https://garrison.upraise.io/rest/upraise/public/1.0/leave/getUserLeaveTypes/{accountId} |
On this page |
---|
Sample JSON response
[
{
"id": 86,
"leaveTypeName": "Casual Leaves",
"paid": true,
"remainingBalanceInDays": 10.5,
"availableMaxCarryOverInDays": 5
},
{
"id": 89,
"leaveTypeName": "Comp Offs",
"paid": true,
"remainingBalanceInDays": 7.7,
"availableMaxCarryOverInDays": 0
},
{
"id": 87,
"leaveTypeName": "Leave without pay",
"paid": false,
"remainingBalanceInDays": 23.1,
"availableMaxCarryOverInDays": 0
},
{
"id": 88,
"leaveTypeName": "Sick Leaves",
"paid": true,
"remainingBalanceInDays": 11.5,
"availableMaxCarryOverInDays": 0
},
{
"id": 90,
"leaveTypeName": "Work from home",
"paid": true,
"remainingBalanceInDays": 9.2,
"availableMaxCarryOverInDays": 0
}
]
Response parameters
Parent | Parameter | Type | Description | Possible values |
---|---|---|---|---|
| id | Number | Leave type ID | 89, 67, 45, 43, etc. |
| leaveTypeName | String | Name of leave type | Sick leave, Comp off |
| paid | String | Based on the leave type settings, this parameter is true or false |
|
| remainingBalanceInDays | Number | Number of leaves remaining for given leave type | 10, 9.5, etc. |
| availableMaxCarryOverInDays | Number | Number of days that can be carried forward for the given leave type | 10, 5, etc. |
Possible error cases and messages
Error Scenarios | Error message | Http Status code |
---|---|---|
Invalid account id accountId user details validation | Please enter a valid account ID | NOT FOUND (404) |
invalid API token | The API token in the request is invalid. Please use a different one | UNAUTHORIZED(401) |
Leave feature disabled | This feature is disabled or you don't have permission to view it. | BAD REQUEST (400) |
loggedIn user permissions validations | You do not have permission to view Leave types for this user. | FORBIDDEN (403) |
accountId user Inactive or Deleted | The user does not have access to UpRaise. | NOT FOUND (404) |