Create leave request
Background
This API is to create leave requests for the users themselves or on behalf of someone else.
API Details
The API operates using a User level API token, resulting in user-specific responses. The response is determined by the user's permission to create leave for other users, as outlined below -
When a user with permission to submit leave requests on behalf of another user utilizes this API, they can specify the account ID in the field, separate from the requester.
When utilizing this API, users without the authorization to create a leave request on behalf of another individual are restricted to inputting only their account ID in this field.
The Leave type should correspond to the leave type ID from the leave policy associated with the user for whom leave request is being initiated.
Request
App name | Endpoint |
---|---|
UpRaise People | https://people.upraise.io/rest/upraise/public/1.0/leave/request |
UpRaise Employee Garrison | https://garrison.upraise.io/rest/upraise/public/1.0/leave/request |
On this page |
---|
Sample Request JSON
{
"requestFor": "6327fe4c61dbef2805bb9a62",
"leaveType": {
"id": 2539
},
"reason": "Due to ill health.",
"fromDate": "2024-7-15",
"toDate": "2024-7-17",
"allFullDays": false,
"leaveApplicationDates": [
{
"leaveDate": "2024-7-15",
"duration": "first half"
},
{
"leaveDate": "2024-7-16",
"duration": "second half"
},
{
"leaveDate": "2024-7-17",
"duration": "full day"
}
],
"visibility": 2,
"teams": [
917,
1277
],
"users": [
"63da09ac010d35637970cff8"
]
}
Request parameters
Parent | Parameter | Type | Description | Possible values |
---|---|---|---|---|
| requestFor | String | Add the account id of the user for whom the leave request is being created. This could be the request for self or other users (if user has permission to create leave request on behalf of others) |
|
| leaveType | Object | This contains the details of leave type |
|
leaveType | id | Number | Add the leave type ID. Users must ensure that the type of leave they select aligns with the policies associated with the user profile for whom leave request is being created. | 9016, 7711, 8259, etc. |
| reason | String | Reason for the leave application. This parameter can be optional, it depends on leave policy settings. |
|
| fromDate | Date | Date from when leaves duration starts. Date format should be yyyy-MM-dd. |
|
| toDate | Date | Date when leaves duration ends. Date format should be yyyy-MM-dd. |
|
| allFullDays | String |
|
|
| leaveApplicationDates | Object | This contains the details of the leave dates and duration of each day of leaves |
|
leaveApplicationDates | leaveDate | Date | Leave date/s | 2024-7-15 |
leaveApplicationDates | duration | String | Duration of each day’s leave |
|
| visibility | Object | This is for the details of the visibility of the leave request |
|
visibility | teams | String | List of teams with whom the leave application is shared | Sales, Support, etc. |
visibility | users | String | Account IDs of the users with whom leave application is shared |
|
Sample response JSON
{
"id": 4245,
"requestFor": {
"id": 6140,
"jiraUserRestApiUrl": "<baseURL>/rest/api/2/user?accountId=6327fe4c61dbef2805bb9a62"
},
"fromDate": "2024-7-15",
"toDate": "2024-7-17",
"noOfDays": 2,
"reason": "Due to ill health.",
"approver": {
"id": 6128,
"jiraUserRestApiUrl": "<baseURL>/rest/api/2/user?accountId=557058:47071b1a-8622-4333-aa39-7db293f3aa34"
}
}
Response parameters
Parent | Parameter | Type | Description | Possible values |
---|---|---|---|---|
| id | Number | User ID who created the leave request | 6751, 6771, etc. |
| requestFor | Object | This object contains all the details of the user for whom the request is created |
|
requestFor | id | Number | User ID for whom request is created | 88, 82, etc. |
requestFor | jiraUserRestApiUrl | String | User’s Jira user Rest API URL | <baseURL>/rest/api/2/user?accountId=6327fe4c61dbef2805bb9a62 |
| fromDate | Date | Date from when leaves duration starts. Date format should be yyyy-MM-dd. |
|
| toDate | Date | Date when leaves duration ends. Date format should be yyyy-MM-dd. |
|
| noOfDays | Number | Number of days in leave duration based on start and end dates as well as the duration of each day like full day, half day. | Any number |
| reason | Sring | Reason for the leave application. It can be an option if that’s how the leave policy setup is done | Any reason for leave application |
| approver | Object | This object contains user details of the leave approver |
|
approver | id | Number | User ID for whom the request is created | 88, 82, etc. |
approver | jiraUserRestApiUrl | String | User’s Jira user Rest API URL | <baseURL>/rest/api/2/user?accountId=557058:47071b1a-8622-4333-aa39-7db293f3aa34 |