Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Sample Request JSON

Code Block
{
  "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)

  • 6327fe4c61dbef2805bb9a62

  • 7820fe9c61dbef2805cc9a52

leaveType

Object

This contains the details of leave type

  • id

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.

  • Going on a vacation

  • Taking leave due to some medical emergency in the family

fromDate

Date

Date from when leaves duration starts. Date format should be yyyy-MM-dd.

  • 2024-07-23

  • 2023-06-12

toDate

Date

Date when leaves duration ends. Date format should be yyyy-MM-dd.

  • 2024-07-30

  • 2023-06-15

allFullDays

String

  • True if all the days in leave duration are full day leaves

  • False if there are one or more half-day leaves

  • true

  • false

leaveApplicationDates

Object

This contains the details of the leave dates and duration of each day of leaves

  • leaveDate

  • duration

leaveApplicationDates

leaveDate

Date

Leave date/s

2024-7-15

leaveApplicationDates

duration

String

Duration of each day’s leave

  • First half

  • Second half

  • Full day

visibility

Object

This is for the details of the visibility of the leave request

  • teams

  • users

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

  • 63da09ac010d35637970cff8

  • 67ca08gc000d35637970chh9

Sample response JSON

Code Block
{
    "id": 4245,
    "requestFor": {
        "id": 6140,
        "jiraUserRestApiUrl": "https://upraise-cloud.atlassian.net/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": "https://upraise-cloud.atlassian.net/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

  • id

  • jiraUserRestApiUrl

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.

  • 2024-07-23

  • 2023-06-12

toDate

Date

Date when leaves duration ends. Date format should be yyyy-MM-dd.

  • 2024-07-30

  • 2023-06-15

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 option if that’s how the leave policy set up is done

Any reason for leave application

approver

Object

This object contains user details of the leave approver

  • id

  • jiraUserRestApiUrl

approver

id

Number

User ID for whom 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