API
Time off
There are two primary entities when dealing with time off. The requests and the history.
Requests represent a request from an employee to take time off. A request needs to be approved before it will be recorded into the history. A user with sufficient permissions can create a request and mark it approved at the same time.
The history is log of all events that effect an employee's balance. The current balance of time off is the sum of all events in the history. Time off used decreases the total, while time off accruals increase it.
- Get time off requests
- Add a time off request
- Add a time off history entry
- Add a time off history override
Get time off requests
| HTTP Method: | GET |
|---|---|
| Path: | /api/gateway.php/{company}/v1/time_off/requests/ |
| Parameters: |
|
| Notes: |
|
| Sample request: | GET /api/gateway.php/test/v1/time_off/requests/?start=2011-09-01&end=2011-09-11&type=1&status=approved |
| Sample response: | |
<requests> <request id="1"> <employee id="1">Jon Doe</employee> <status lastChanged="2011-08-14" lastChangedByUserId="1">approved</status> <start>2001-01-01</start> <end>2001-01-01</end> <created>2011-08-13</created> <type id="1">Vacation</type> <amount unit="days">5</amount> <notes> <note from="employee">Relaxing in the country for a few days.</note> <note from="manager">Have fun!</note> </notes> </request> </requests> |
|
Add a time off request
| Description: | A time off request is an entity that describes the decision making process for approving time off. Once a request has been created, a history entry can be created documenting the actual use of time off. |
|---|---|
| HTTP Method: | PUT |
| Path: | /api/gateway.php/{company}/v1/employees/{employee id}/time_off/request/ |
| Sample request: | PUT /api/gateway.php/test/v1/employees/1/time_off/request/ |
| Sample post data | |
<request> <status>approved</status> <start>2011-10-01</start> <end>2011-10-02</end> <timeOffTypeId>1</timeOffTypeId> <amount>2</amount> <notes> <note from="employee">Having wisdom teeth removed.</note> <note from="manager">Get well soon</note> </notes> </request> |
|
| Notes: |
|
Add a time off history entry
| Description: | To use this API make an HTTP PUT where the body of the request is the XML documented below. A new time off history item will be inserted into the database. On success, a 201 Created code is returned and the "Location" header of the response will contain a url that identifies the new request. |
|---|---|
| HTTP Method: | PUT |
| Path: | /api/gateway.php/{company}/v1/employees/{employee id}/time_off/history/ |
| Sample request: | PUT /api/gateway.php/test/v1/employees/1/time_off/history/ |
| Sample post data | |
<history> <date>2011-10-18</date> <eventType>used</eventType> <timeOffRequestId>1</timeOffRequestId> <note>Having wisdom teeth removed.</note> </history> |
|
| Notes: |
|
Add a time off history override
| Description: | To use this API make an HTTP PUT where the body of the request is the XML documented below. A new time off history item will be inserted into the database. On success, a 201 Created code is returned and the "Location" header of the response will contain a url that identifies the new request. |
|---|---|
| HTTP Method: | PUT |
| Path: | /api/gateway.php/{company}/v1/employees/{employee id}/time_off/history/ |
| Sample request: | PUT /api/gateway.php/test/v1/employees/1/time_off/history/ |
| Sample post data | |
<history> <date>2011-10-18</date> <eventType>override</eventType> <timeOffTypeId>1</timeOffTypeId> <amount>-5</amount> <note>Having wisdom teeth removed.</note> </history> |
|
| Notes: |
|
Have more questions? We're here to help, so please contact us.