Time Off Requests
Time off requests allow employees to seek approval for their absence from work for a certain period. These requests are usually based on the Time off policies you created to guide your employees' requests. Managing Time Off requests ensures that employee absences are well documented and do not disrupt the company's workflow or productivity during their absence.
Endpoints Overview
Before you can create and manage Time off requests, your company must have set up their Time off request types. The endpoints to set them up include the following:
Request Type | Endpoint Name | Endpoint |
---|---|---|
GET | Get list of Time off request types | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/types |
POST | Create Time off request type | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/types |
GET | Retrieves Time off request type information | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/types/{requestTypeId} |
PATCH | Update Time off request type | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/types/{requestTypeId} |
DELETE | Remove Time off request type | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/types/{requestTypeId} |
GET | Get Time off request setup | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/setup |
POST | Create Time off request setup | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/setup |
PATCH | Update Time off request setup | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/setup |
Creating and managing Time off requests can be the responsibility of both employees and company admins. Thus, they call different endpoints, which we highlight below.
You can call the following endpoints to create and manage your Time off requests as an employee:
Request Type | Endpoint name | Endpoint |
---|---|---|
GET | Get list of Time off requests (Employees) | https://api.worklio.com/wep/companies/{companyId}/employees/{employeeId}/timeoffrequests |
POST | Create Time off request | https://api.worklio.com/wep/companies/{companyId}/employees/{employeeId}/timeoffrequests |
GET | Retrieves Time Off request information | https://api.worklio.com/wep/companies/{companyId}/employees/{employeeId}/timeoffrequests/{requestId} |
PATCH | Update Time off requests | https://api.worklio.com/wep/companies/{companyId}/employees/{employeeId}/timeoffrequests/{requestId} |
DELETE | Remove Time off request | https://api.worklio.com/wep/companies/{companyId}/employees/{employeeId}/timeoffrequests/{requestId} |
You can call the following endpoints to create and manage your employees' Time off requests as an admin:
Request Type | Endpoint Name | Endpoint* |
---|---|---|
GET | Get list of Time off requests | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests |
POST | Create Time off requests | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests |
GET | Retrieves Time off request information | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/{requestId} |
PATCH | Update Time off requests | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/{requestId} |
DELETE | Remove Time off requests | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/{requestId} |
POST | Approve Time off request | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/{requestId}/approve |
POST | Deny Time off request | https://api.worklio.com/wep/companies/{companyId}/timeoffrequests/{requestId}/deny |
Common Use Cases
The common use cases for employees include the following:
Creating a Time off request
An employee creates a time off request to get off work for a specified time. For each request, the employee calls the create Time off request endpoint with their ID and company ID set in the path parameter. Also, you must set the start date and the request type ID in the body parameter. A successful call returns an item of object containing the request status and other request details.
Updating a Time off request
You can only call this endpoint in two circumstances:
- after creating a time off request
- before the request is approved
To update the Time off request, call the update time off request endpoint.
Deleting a Time off request
Calling this endpoint allows employees to cancel or delete their Time off request before their supervisor approves or denies it. You can only call this endpoint if the admin has not called the approve or deny endpoint on the request. Calling this endpoint deletes the request from the system.
The common use cases for admins include the following:
Approving Time off request
As an admin, when an employee requests Time off, you call this endpoint to approve it. The system requires that you add a note in the body parameter.
Denying Time off request
You call the deny Time off request if you do not want to approve the employee's request. You can only call this endpoint after the employee requests Time off.
Creating Time off request
As an admin, you call this endpoint to create a request for your employees when they are unable to do it themselves. When calling this endpoint, you must set the information regarding the employee's Time off.
Creating Time off request set up
As an admin, you can create a time off request setup. You can only create one setup, as you cannot create multiple setups. If the setup already exists, it will only be updated by calling the update endpoint.
Creating Time off request type
When creating a time off request type, you set up the different Time off request types that your employees can access. You create as many request types as you need by calling this endpoint.
Updated 3 months ago